6 ms·
That's the Maybe type. The Maybe monad is this: instance Monad Maybe where return = Just Nothing >>= _ = Nothing Just x >>= f = f x (And is not
by Peaker 8y ago
That's the Maybe type. The Maybe monad is this:
instance Monad Maybe where
return = Just
Nothing >>= _ = Nothing
Just x >>= f = f x
(And is not really related to the discussion)
- pera 8y agoRight! that definition was the type, thanks for the correction :) still, the Maybe monad is used for computations that may fail, which is often the purpose of the null pointer.