:: Maybe a -> a package:relude

The fromJust function extracts the element out of a Just and throws an error if its argument is Nothing.

Examples

Basic usage:
>>> fromJust (Just 1)
1
>>> 2 * (fromJust (Just 10))
20
>>> 2 * (fromJust Nothing)
*** Exception: Maybe.fromJust: Nothing
...
WARNING: This function is partial. You can use case-matching instead.
Extracts Monoid value from Maybe returning mempty if Nothing.
>>> maybeToMonoid (Just [1,2,3] :: Maybe [Int])
[1,2,3]

>>> maybeToMonoid (Nothing :: Maybe [Int])
[]