A discussion about referential transparency and I/O in Haskell popped
up in Comp.lang.scheme. The example was something like:
do
x <- getLine
y <- getLine
...with...
getLine :: IO String
And so my question is what is the value of getLine? I had thought of
it as sort of a "placeholder" or "indicator" to the IO monad to
provide another chunk of the input to the function that follows
getLine. So without the syntax of "do"...
getLine >>= \s1 -> print s1 >> getLine >>= \s2 -> print s2
...in my mind was read as "getLine indicates to the >>= function to
bind some input to s1, and then getLine indicates to the >>=
function to bind some more input to s2".
But do x and y, above, have different values? How can that be
rationalized as referentially transparent?
Thanks from a beginner.
--
Patrick Logan mailto:[EMAIL PROTECTED]
Voice 503-533-3365 Fax 503-629-8556
Gemstone Systems, Inc http://www.gemstone.com