Below is an example from the Haskell Tutorial
instance Monad Maybe where
return x = Just x
Nothing >>= f = Nothing
Just x >>= f = f x
fail _ = Nothing
However, the line confuses me Just x.... Should the result not be a monad? I expect the string to be
Just x >>= f = Just (f x)
source
share