darcs patch: Add justIf to Data.Maybe

Jon Fairbairn jon.fairbairn at cl.cam.ac.uk
Sat Aug 22 05:13:12 EDT 2009

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

> Hi,
> 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).

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

More information about the Libraries mailing list