Mark P Jones wrote:

> Simon Marlow writes:
>
> | All known Haskell compilers implement the IO type as a function type,
> | something like (World -> (World, a)).  You can think of the monad
> | as just a convenient way to hide the passing around of the world token.
> |
> | And because it is abstract, compilers are free to implement it
> | however they like.
>
> I would refute Simon's first point (it depends on how you interpret
> the word "compiler"), but strongly support his second.  In Hugs, I
> did actually use a different implementation of the IO monad, based
> on continuation passing, which looked something like:
>
>    IO a  =  (a -> Ans) -> (IOError -> Ans) -> Ans
>
> In other words, there is no explicit World, and a choice of two
> continuations, one for success, and one for failure.

And HBC does something very similar.  In fact the real implementation of
I/O in HBC is still the old streams of request responses.  And IO should
definitely be thought of as abstract.


--

        -- Lennart



Reply via email to