Proposal to deprecate and then drop fromJust
Konstantine Rybnikov
k-bx at k-bx.com
Wed Feb 25 06:25:20 UTC 2015
Maybe it would make sense to incorporate fromJustNote (as in `safe`
package) and highly recommend that one in docs? It makes it easier to debug
error and to realize that it will throw an error on Nothing.
25 лют. 2015 00:36, користувач "Daniel Díaz" <dhelta.diaz at gmail.com>
написав:
> Hi.
>
> This function has been guilty (more than once) of making my debugging
> harder by providing
> too little error information. Sure, the programmer who wrote the code
> should have made
> sure that the argument could not possibly be Nothing, but that didn't
> stopped him/her
> to use fromJust. Yes, there is always a way to make an "error" happen, but
> without
> fromJust you'll have to do so explicitly. I think we should encourage good
> practices.
> Just my point of view.
>
> The downside I see are the current occurrences of fromJust all around. I
> guess they are
> a huge lot. Although I would love to get rid of them, this would require
> some work (even
> if it's very little) from a lot of developers. So if we want to do this, a
> consensus
> must be built first.
>
> Therefore, +1 from me.
>
> Best regards,
> Daniel Díaz.
>
> On 02/24/2015 06:42 AM, 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
>>
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20150225/9d416df5/attachment-0001.html>
More information about the Libraries
mailing list