Proposal: add new function "check" to Control.Monad
Jon Fairbairn
jon.fairbairn at cl.cam.ac.uk
Thu Sep 17 11:15:15 EDT 2009
Jon Fairbairn <jon.fairbairn at cl.cam.ac.uk> writes:
> Trac ticket #3453. Two week time frame.
>
> Add check function to Control.Monad
>
> check :: (MonadPlus m) => (a -> Bool) -> a -> m a
> check p a
> | p a = return a
> | otherwise = mzero
My impression is that the consensus is not to add this, mostly because
of the "names for small functions" argument with which I heartily
concur, though I suspect that I prejudiced things by not giving a strong
enough justification to begin with (eg that what I'd really like to see
is check -- by whatever name -- and to deprecate guard as something that
encourages imperative thinking)
So I've formally proposed mfilter instead. I imagine that I should close
this ticket: is the correct resolution "wontfix"?
--
Jón Fairbairn Jon.Fairbairn at cl.cam.ac.uk
More information about the Libraries
mailing list