[Haskell-cafe] Re: Changing type of 'when'

Gleb Alexeyev gleb.alexeev at gmail.com
Wed Jan 28 08:20:52 EST 2009


Maurí­cio wrote:

> ? It is easy for 'when' to ignore the result
> of the first computation, and this would not
> break existing code, and also save a lot of
>  >> return ()s.

As Neil Mitchell pointed out[1], ignoring results implicitly may 
indicate an error. Perhaps it's cleaner to define

ignore m = m >> return ()

and use it like this:
when condition $ ignore doSmth

[1]http://neilmitchell.blogspot.com/2008/12/mapm-mapm-and-monadic-statements.html



More information about the Haskell-Cafe mailing list