Adding an ignore function to Control.Monad

John Meacham john at
Thu Jun 11 18:44:17 EDT 2009

On Thu, Jun 11, 2009 at 11:21:54PM +0100, Sittampalam, Ganesh wrote:
> John Meacham wrote:
> > 
> > And here I always get annoyed by types that specify '()' explicitly
> > when a universally quantified type will do. (`when` and `unless` are
> > particularly offensive in this regard). Forcing idioms to be more
> > verbose than necessary obscures intent.   
> > 
> > Do we have any data that accidentally ignoring return values is a
> > problem in practice?
> On the flip side, could you give some examples where ignoring return
> values is useful and natural?

certainly, the very useful parser example mentioned.

(char 'x' >> char 'y') - we want to parse x, then y
(char 'x' `mplus` char 'y') - we want to parse one of x or y, returning
which one we got so we can change behavior based on it.

When using the 'Writer' monad or similar it comes up a whole lot.
sometimes you are interested in the result, sometimes the written value,
sometimes both. 

there are a lot more monads out there than 'IO', or even generalized
state monads. The initial thread took a lesson from the C language and
tried to apply it to all monads in general, which is certainly flawed.
Monads are way more interesting than C program flow, and even C
explicitly gave up on '(void)' casts for function returns on


John Meacham - ⑆⑆john⑈ -

More information about the Libraries mailing list