Proposal to deprecate and then drop fromJust

Roman Cheplyaka roma at
Tue Feb 24 09:09:12 UTC 2015

I don't use fromJust in my code.

However, fromJust is incredibly handy when working in ghci.

Say I have

  parse :: String -> Maybe Value
  process :: Value -> IO ()

Then (process . fromJust . parse) is the fastest way to compose the two.

So I'm -1 on dropping fromJust, but I don't object to adding a
deprecation warning to it.

Then again, why aren't we doing the same to head&tail?

On 24/02/15 07:42, Erik de Castro Lopo 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?
> Erik

More information about the Libraries mailing list