On 2012/1/1 Ertugrul Söylemez <es@ertes.de> wrote:
Steve Horne <sh006d3592@blueyonder.co.uk> wrote:And that's fine, because IO is an embedded DSL. A better view of IO is
> Of course even the bind operator arguably isn't primitive. We could
> translate to get rid of those too, and see what lies underneath. This
> is where we start seeing functions of type...
>
> World -> (x, World)
>
> Problem - this level of abstraction is hypothetical. It is not part of
> the Haskell language. Haskell specifically defines the IO monad to be
> a black box.
a GADT like:
data IO :: * -> * where
GetLine :: IO String
PutStrLn :: String -> IO ()
...
This is still hypothetical, but it shows how even IO is easily
referentially transparent (as long as you don't use unsafe* cheats).