This is not what the calculation expression is expected to be written to. Every time you want to "give a result", you need to add some keyword (return, return !, yield or yield!) On the left side of the expression, in your example, I would add return!
:
let foobar =
MaybeMonad {
let! foo = Just "foo"
return! Just 1
return! Nothing
}
But then you need to add its definition to the constructor:
member this.ReturnFrom (expr) = expr
Delay, , - :
member this.Delay(x) = x()
, , , Combine
, , , , :/p >
let foobar : Maybe<int> =
MaybeMonad {
let! foo = Just "foo"
return! Just 1
return! Nothing
}
, :
Bind called
Combine called
val foobar : Maybe<int> = Nothing
CE, : https://www.microsoft.com/en-us/research/publication/the-f-computation-expression-zoo/