world as value

Marco Kesseler mke@oce.nl
Wed, 16 Jun 1999 14:14:04 +0200


Stephane Letz wrote:
>There is something that remains not clear for me. In a context of a
>functional program doing I/O  what is the correct notion of value?
>Is it the "I/O program" itself  (to be applied to the *World object)  OR
>the result of the interaction of the I/O program on the *World object?
>It seems that to keep referential tranparency only  the second  solution is
>correct.

Maybe it is not entirely clear to me what you mean, but I'd say
that BOTH are correct notions of value.

Look at it in the same way as you would consider a function
f :: a -> b

Then 'f' alone is a value of type 'a -> b', whereas 'f x' is a
value of type 'b'.

So, any IO program is a value of type 'World -> World', whereas
the program applied to a particular world is a value of type
'World'

For the rest I think I agree with Pedro. The whole point is
that in general functions operating on some world cannot guarantee
that they return the same world in their result. So:

(success, file, world') = fopen 'file.txt' world

does not imply that world' == world, whether opening succeeded or
not. 

Cheers,
Marco

---------------------------------------------

Marco Kesseler
Oce-Technologies B.V.
St. Urbanusweg 43, Venlo, The Netherlands
P.O. Box 101, 5900 MA Venlo, The Netherlands
telephone +31 77 359 5158
fax       +31 77 359 5450
e-mail    mke@oce.nl