Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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)


Right! 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: