attempt = async (fn) => {
  try {
    const value = await fn()
    return { ok: true, value }
  } catch (err) {
    const error = /** @type {Error} */(err)
    return { ok: false, error }
  }
}
@template T
@param {() => Promise<T>} fn
@returns {Promise<{ok:true, value:T}|{ok:false, error:Error}>}