2009/4/9 Mark Spezzano <mark.spezzano@chariot.net.au>

Or does RT ignore the encapsulated data and just view the “action” performed by the monad as the “value” of the monad?


If I understand you right, this is more-or-less correct.

You may as well think of IO as some sort of algebraic type that you are building and returning.  A value of type "IO Integer" is not, itself, an integer.  Thus:

main =
  let r = print "hello"
  in return ()

Prints nothing.  RT steps in in a similar scenario:

main =
  let r = print "hello"
  in do { r; r }

Replacing "r" with its definition:

main = do { print "hello"; print "hello" }

As expected.

Luke


 

Just curious as to the rationale behind referential transparency and how it applies to monads.

 

Cheers,

 

Mark Spezzano

 


No virus found in this outgoing message.
Checked by AVG.
Version: 7.5.557 / Virus Database: 270.11.48/2048 - Release Date: 8/04/2009 7:02 PM


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