darcs patch: Add justIf to Data.Maybe

Jon Fairbairn jon.fairbairn at cl.cam.ac.uk
Sat Aug 22 10:15:39 EDT 2009


Joachim Breitner <mail at joachim-breitner.de> writes:

> Hi,
>
> Am Samstag, den 22.08.2009, 10:13 +0100 schrieb Jon Fairbairn:
>> Joachim Breitner <mail at joachim-breitner.de> writes:
>> > I propose the attached change, with a discussion timeframe until end of
>> > September. The corresponding ticket is
>> > http://hackage.haskell.org/trac/ghc/ticket/3446
>> >
>> > Thanks,
>> > Joachim
>> 
>> I have been meaning to get round to proposing check for Data.Monad:
>> 
>> > check :: (MonadPlus m) => (a -> Bool) -> a -> m a
>> > check p a
>> >     | p a = return a
>> >     | otherwise = mzero
>> 
>> Now justIf = flip (check . const)
>> 
>> So I suggest that it would be better to add check first(, and then
>> possibly switch the order of arguments to justIf).
>
> are you proposing that, if check is available, no justIf is needed in
> the libraries?

I wouldn't be proposing that, having promised not to post on the topic
of naming short functions for ten years.

> Or are you just proposing a different implementation?

I /am/ proposing that. I suppose I have to work out how to make a proper
proposal for the addition of check?

-- 
Jón Fairbairn                                 Jon.Fairbairn at cl.cam.ac.uk




More information about the Libraries mailing list