Proposal to deprecate and then drop fromJust

Chris Allen cma at bitemyapp.com
Tue Feb 24 05:51:41 UTC 2015


I'm strongly in favor of removing this so as not to confuse new people 
with partial functions that have impossible type signatures.

+1

On 02/23/2015 11:49 PM, Ivan Lazar Miljenovic wrote:
> On 24 February 2015 at 16:42, Erik de Castro Lopo <mle+hs at mega-nerd.com> 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
> construction.
>
> 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
> occurred).
>
> So I'm undecided; maybe (no pun intended!) -0.1.
>
>> Erik
>> --
>> ----------------------------------------------------------------------
>> Erik de Castro Lopo
>> http://www.mega-nerd.com/
>> _______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
>



More information about the Libraries mailing list