W. Brian Gourlie
1 min readMar 16, 2017

--

I don’t know what languages you are referring to. As a haskeller I can safely say this is false for haskell, which has a “first-class” option type

It is not false. Just because you aren’t handling all cases doesn’t mean that the compiler isn’t enforcing that all possibilities are considered. In fact, the source for fromJust is as follows:

fromJust          :: Maybe a -> a
fromJust Nothing = errorWithoutStackTrace "Maybe.fromJust: Nothing" -- yuck
fromJust (Just x) = x

Now, show me the part where the compiler isn’t enforcing that all cases are handled. You seem to be confusing “having to handle the possibility of present and not-present values” with “having convenience functions that will just throw an exception for a particular condition.”

Any language that has Maybe or Result types are almost certainly going to have similar convenience methods, but the argument that this is somehow a shortcoming of the type system operating under a false premise.

--

--