The option monad example might be closer. I'm having trouble figuring out how to get the value out of it though
data Option a =
Some a | None
let optionMonad = {
return: fn x =
Some x
bind: fn x f = match x
case (Some a) = f a
case None = None
}
let m = (do optionMonad
bind x = Some 1
let y = 2
bind z = Some 3
return x + y + z
)
match m
case (Some x) = console.log x
shows an error Error: Type error: Native is not Option 'dwk
Comments
The option monad example might be closer. I'm having trouble figuring out how to get the value out of it though
shows an error Error: Type error: Native is not Option 'dwkBug in the type system. Fixed. Roy could be cached so you might need to force a refresh.