Proposal: Add Chris Done's "om" combinator to Control.Monad

Henning Thielemann lemming at henning-thielemann.de
Fri Jul 26 21:40:36 CEST 2013


On Fri, 26 Jul 2013, Greg Fitzgerald wrote:

>> Are there any examples of "nom" being useful?
>
> I find 'nom' to be useful if defined as "const id":
>
>
> -- Given 'om'
> om f m = (m >>=) . flip f
>
> -- And 'nom'
> nom = const id
>
> -- And the natural name for a monadic version of 'no'thing
> noM = return ()
>
> -- We construct a useful example of 'nom':
> eatCookies :: IO ()
> eatCookies = om nom noM noM

So far I was not convinced by the proposal. But this one seems to be 
really useful and a real world application!




More information about the Libraries mailing list