These functions are subtly different: they must return a to the bindfunction , but it accepts any ordinary function.fResult<_>lift
Think of it this way: bind“attaches” another, possibly failed calculation to the previous calculation chain:
let isOdd x = if x % 2 = 0 then ok x else fail "Even!"
let x = ok 5
let oddX = x |> bind isOdd
while lift "" "" Result<_>:
let plus5 x = x + 5
let liftedPlus5 = lift plus5
let seven = liftedPlus5 (ok 2)
, : . .
( bind)
P.S. , - F # .