[Haskell-cafe] Re: what is inverse of mzero and return?

Ashley Yakeley ashley at semantic.org
Mon Jan 24 05:21:50 EST 2005


In article <41F4C18C.7030508 at imperial.ac.uk>,
 Keean Schupke <k.schupke at imperial.ac.uk> wrote:

> Yes it is, side effects are quite clearly not counted. The value
> of (putStrLn "Hello" >> mzero") is mzero.

I don't believe this represents a good understanding of IO actions as 
Haskell values. For instance, 'return ()' and 'putStrLn "Hello"' are the 
same type, but are clearly different actions and so are usually 
considered to be different values. That the latter prints out text might 
be better considered not so much a "side effect" as the actual action 
itself.

You've introduced the concept of "the value of" an IO action, apparently 
as something separated from "side effects". I don't believe you can 
properly define this. For instance, what is the "value" of getChar such 
that it doesn't involve "side effects"?

-- 
Ashley Yakeley, Seattle WA



More information about the Haskell-Cafe mailing list