News for hackers. Stuff that matters.
Re:Language Design Deal Breakers by munin on Saturday May 25, 2013 @09:14PM (#5769606)
Yeah, I just think that at every point in your program where you will have a Maybe the failure case could be as inelegant to program execution as raising an uncaught NullPointerException, and escaping that involves a lot more work than using a language without a NullPointerException.

Maybe I should write more Haskell code, but this has definitely been my experience with OCaml...

Re:Language Design Deal Breakers by gizmo686 on Sunday May 26, 2013 @01:03AM (#5770104)
I've never used OCaml, but Haskell isn't as bad as you describe. When you use Maybe, you do not have to deal with the Nothing (ie. Null) case until you want to escape the monad (even then, you could still ignore it, and just crash if you do have Nothing).

If an intermediate calculation results in Nothing, then the final value will be Nothing. Handling this is as simple as:

foo :: Maybe Int -> Int

foo Nothing = 0

foo (Just x) = x