
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 purpose. John -- John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/