Say I have
x = Just 2
Is there a way (preferrably a builtin mechanism/function) to use x in a single statement such that if it is a Just, t
For this particular case, fromJust. In general
fromJust
let Just k = x in f k + 2 == 4
This trick works with any datatype constructor and is very commonly used with (:) for nonempty lists.
(:)