Proposal to deprecate and then drop fromJust

Johan Tibell johan.tibell at gmail.com
Tue Feb 24 10:33:41 UTC 2015


-1 for this reason. A strong recommendation in the docs is enough. There
are legitimate uses and the busy work involved in fixing the 10,000 uses is
not with it. That's time that could be spent on more libraries.
On Feb 24, 2015 7:19 AM, "Chris Allen" <cma at bitemyapp.com> wrote:

> Just a quick look on Github, filtering for uses of fromJust rather than
> re-declarations (mostly), shows 9,418 uses.
>
> https://github.com/search?utf8=%E2%9C%93&q=extension%
> 3Ahs+fromJust+%22import+Data.Maybe%22&type=Code&ref=searchresults
>
> Searching for imports of Data.Maybe alone come to 19,985, indicating that
> at least ~half of the time people import Data.Maybe, they're using fromJust.
>
> https://github.com/search?utf8=%E2%9C%93&q=extension%
> 3Ahs+%22import+Data.Maybe%22&type=Code&ref=searchresults
>
> As a baseline, Data.List shows up 28k times.
>
> https://github.com/search?utf8=%E2%9C%93&q=extension%
> 3Ahs+%22import+Data.List%22&type=Code&ref=searchresults
>
> This is just from a 3 minute glance. If we really want to narrow it down
> to Hackage I'll do something more thorough.
>
> On 02/24/2015 12:13 AM, Bardur Arantsson wrote:
>
>> On 24-02-2015 06: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?
>>>
>>>  How much code on Hackage is currently using fromJust? (A rough estimate
>> by group would probably be sufficient.)
>>
>> Regards,
>>
>>
>> _______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>>
>
> _______________________________________________
> 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/20150224/a77215ac/attachment.html>


More information about the Libraries mailing list