Proposal: Add bool to Data.Bool
Artyom Kazak
yom at artyom.me
Wed Sep 11 00:08:29 CEST 2013
Eh, no. Basic functions — simple names.
Besides, it might be my faulty memory, but I doubt I would be able to
remember boolElim. It’s somewhat cryptic.
On Wed, 11 Sep 2013 02:05:15 +0400, Carter Schonwald
<carter.schonwald at gmail.com> wrote:
> just to add a bit of bikeshedding, wouldn't it better be called
> something like boolElim ?
>
>
> On Tue, Sep 10, 2013 at 6:02 PM, Oliver Charles <ollie at ocharles.org.uk>
> wrote:
>
>
>> Hello,
>>
>>
>>
>> I would like to propose that the following is added to Data.Bool in
>> base:
>>
>>
>>
>> bool :: a -> a -> Bool -> a
>>
>> bool f _ False = f
>>
>> bool _ t True = t
>>
>>
>>
>> (Aka, bool f t b = if b then t else f)
>>
>>
>>
>> The purpose of this is hopefully evident from its definition. I find
>>
>> myself reaching for this in cases similar to where I would use 'maybe' -
>>
>> often when I'm working with 'fmap' and don't want to start introducing
>>
>> names for the function I am using to map over some functor.
>>
>>
>>
>> I suggested this in #haskell and other people also seem frustrated this
>>
>> doesn't exist, and would like to see it happen - hopefully they will
>>
>> voice their support as a reply here.
>>
>>
>>
>> A quick search on FPComplete's Hoogle [1] shows five equivalent
>>
>> functions on the first page - and I'm sure there are more on subsequent
>>
>> pages.
>>
>>
>>
>> Thoughts?
>>
>> - ocharles
>>
>>
>>
>> ---
>>
>> [1]:
>>
>> https://www.fpcomplete.com/hoogle?q=Bool+-%3E+a+-%3E+a+-%3E+a&env=ghc-7.4.2-stable-13.09
>>
>>
>>
>>
>> _______________________________________________
>>
>> Libraries mailing list
>>
>> Libraries at haskell.org
>>
>> http://www.haskell.org/mailman/listinfo/libraries
>>
>>
>
More information about the Libraries
mailing list