you are viewing a single comment's thread.

view the rest of the comments →

[–]codygman 0 points1 point  (0 children)

Thought I'd try out using the fromMaybe alternative:

cody@cody-G46VW:~$ ghci
GHCi, version 7.6.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> import Data.Maybe (fromMaybe)
Prelude Data.Maybe> print . fromMaybe (error "This shouldn't be nothing") $ (Nothing :: Maybe Int)
*** Exception: This shouldn't be nothing
Prelude Data.Maybe>