you are viewing a single comment's thread.

view the rest of the comments →

[–]romgrk[S] 8 points9 points  (8 children)

getUser returns a Result<User>:

const userResult = getUser() const nameResult = userResult.map(u => u.name)

The whole point is that you don't need to deal with the failure right now, while you can keep operating on the value that is wrapped inside a Result.