Fwd: Re: Yet Another Monad Tutorial

Keith Wansbrough Keith.Wansbrough@cl.cam.ac.uk
Wed, 13 Aug 2003 13:30:01 +0100


> Think of the following though experiment. What if I would have a function 
> "unparse:IO a->String" which gives the textual representation of the 
> specification of the object of type IO a? Clearly, IO is not a monad 
> anymore. Moreover, I don't think it would break the purity of Haskell. And 
> surely, in case of the IO monad, we can think of better manners to break a 
> program down.

Why would such a function cause IO to cease being a monad?

There's no reason such a function couldn't be written, given an
appropriate implementation of IO, and an implementation that is able
to print a representation of a function (not too difficult for an
interpreter).  Imagine adding "deriving Show" to the data types IO and
SysCall suggested by Ross Paterson in
<20030813092707.GA1151@soi.city.ac.uk>.

--KW 8-)