Hi Gregg,

Gregg Reynolds wrote:
Right; "implementation of IO" means also an implementation for >>=, not just
the IO operators.  I hadn't thought about that but it's hugely important for
the exposition of monads and IO.

Indeed, that's very important.

Note that the topics "monads in Haskell" and "IO in Haskell" can (and in my opinion should) be understood independently of each other.

IO in Haskell is just an abstract data type, with a bunch of functions

  return :: a -> IO a
  bind :: IO a -> (a -> IO b) -> IO b
  getChar :: IO Char
  putChar :: a -> IO ()
  ...

A Haskell runtime system is a somewhat vaguely specified interpreter for (IO a) values. While it would be nice to a have a better specification of that interpreter, it is not part of the semantics of the language Haskell.

"The IO Char indicates that getChar, when invoked, performs some action
which returns a character." (Gentle Intro, typical of many expositions.)

I guess that "invoked" here means really "interpreted by your Haskell implementation during its interpretation of the (IO a) your main function constructed".

  Tillmann
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to