Proposal to deprecate and then drop fromJust

Ivan Lazar Miljenovic ivan.miljenovic at
Tue Feb 24 05:49:47 UTC 2015

On 24 February 2015 at 16:42, Erik de Castro Lopo <mle+hs at> wrote:
> Hi all,
> We currently have in the Data.Maybe module from base:
>      fromJust :: Maybe a -> a
> which newbies often find using hoogle or other search tools and is
> a huge trap. *Every* usage of the above can be replaced by using
>       fromMaybe :: a -> Maybe a -> a
> which forces the user to provide a default value for the case where
> the Maybe a is a Nothing.
> The idea would be to deprecate fromMaybe for 7.12 and remove it
> completely later.
> Comments?

I've used fromJust in the past when I knew the value would be Just by

That said, I could always have written my own fromJust function with a
custom error message, and did switch some of them to direct pattern
matches (so that at least the error message said *where* the error

So I'm undecided; maybe (no pun intended!) -0.1.

> Erik
> --
> ----------------------------------------------------------------------
> Erik de Castro Lopo
> _______________________________________________
> Libraries mailing list
> Libraries at

Ivan Lazar Miljenovic
Ivan.Miljenovic at

More information about the Libraries mailing list