Adding an ignore function to Control.Monad

Edward Kmett ekmett at
Thu Jun 11 16:52:08 EDT 2009

Henning, Felipe,

In the end, neither solution (changing the type of (>>) to require explicit
'ignores' vs. coping with the occasionally discarded important result) is
perfect, so the bikeshed is highly unlikely to be repainted, especially
since due to it being initially painted the other way, the preponderance of
existing monadic code would have to rewritten to make any shift in the
typing of (>>).

Even if we had a time machine and wanted to go back and re-spec Monad again
without the burden of prior art, I'm not entirely sure I would be in favor
of enforcing an explicit discard through typing. Somewhat tongue in cheek,
it seems that a 'must keep or consciously discard' parameter is more of the
domain of a substructural type system than a library.

That said, I do support the creation of an explicit ignore method, if only
because the '() <$' idiom is less obvious in its intent at first glance and
that the applications of ignore go beyond (>>), because of the types of
mplus and (<|>).
-Edward Kmett

On Thu, Jun 11, 2009 at 4:26 PM, Felipe Lessa <felipe.lessa at>wrote:

> On Thu, Jun 11, 2009 at 04:14:22PM -0400, David Menendez wrote:
> > Aside from assertions that this is a bad thing because you say so,
> > what evidence do we have that this is a problem?
> The wiki mentions the problem with forgetting the results of an
> operation.  Another problem is using functions that needlessly
> produce results because you're interested in the side effects
> only.  For example,
>  do mapM something1 list
>     something2
> (Hmmm, would something like
>  {-# RULES "mapM/mapM_" mapM = mapM_ #-}
> work nicely?)
> --
> Felipe.
>  _______________________________________________
> Libraries mailing list
> Libraries at
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Libraries mailing list