I think need to also unwrap the Ok(_) may be a little too much syntax and I would much prefer let? without it:
let getUser = async (id) => {
/* if fetchUser returns Error e, the function returns Error e here. Same for all other `maybe` */
let? user = await fetchUser(id)
let? decodedUser = decodeUser(user)
Console.log(`Got user ${decodedUser.name}!`)
let? () = await ensureUserActive(decodedUser)
Ok(decodedUser)
}
Even though this syntax supports Some(), realistically I don’t think I’ve ever needed to unwrap an option more than one level and I usually do it inline, so in that sense I would only ever use this as a let? <result> (and I would use this often) - so would prefer a simpler syntax
Another option if possible, the question mark on the unwrapper?
let Ok?(user) = await fetchUser(id)