Proposal: Add isLeft/isRight to Data.Either
Bas van Dijk
v.dijk.bas at gmail.com
Fri Dec 7 10:49:49 CET 2012
On 7 December 2012 10:25, Erik Hesselink <hesselink at gmail.com> wrote:
> On Fri, Dec 7, 2012 at 9:29 AM, Bas van Dijk <v.dijk.bas at gmail.com> wrote:
>> On 6 December 2012 23:05, Evan Laforge <qdunkan at gmail.com> wrote:
>>>>> - I often use the 'when'-like combinator 'whenJust' in monadic code:
>>>>>
>>>>> whenJust :: Monad m => Maybe a -> (a -> m ()) -> m ()
>>>>> whenJust (Just x) a = a x
>>>>> whenJust _ _ = return ()
>>>>
>>>>
>>>> +1. whenJust is defined also in Agda.Utils.Monad, should also added to
>>>> Control.Monad.
>>>
>>> Off topic, but I have whenJust in my local library too, and I use it
>>> all the time.
>>
>> In a project at work:
>>
>> $ grep -r whenJust --include=\*.hs . | wc -l
>> 27
>
> There is no need to define whenJust, since it is just a specialization
> of forM_ from Data.Foldable.
Thanks for pointing this out! Replacing the 27 whenJusts as we speak...
Bas
More information about the Libraries
mailing list