
Hallo, Take following function: f::Array Int Char -> (Array Int Char, Char) f array = (array1, c) where c = array!1 array1 = array//[(2,'b')] and also following function: f::Direct_access_file -> (Direct_access_file, Char) f daf = (daf1, c) where c = getnext daf daf1 = set 2 'b' with a hypothetical format for the direct access file. Now I can certainly implement the first function in Haskell but not the second. Now the only difference between the two functions is the location of the data: in the first the data of the array are in RAM, in the second the data of the direct access file are on disk. There is no other difference. As far as referential integrity is concerened I don't see any difference too. So why can I implement the first function and not the second (well I can use direct access files but I have to change the type of my function.The problem is: I do not see why the location of data should have an influence here. Greetings, __________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com

naudts guido wrote:
Take following function:
f::Array Int Char -> (Array Int Char, Char) f array = (array1, c) where c = array!1 array1 = array//[(2,'b')]
and also following function: f::Direct_access_file -> (Direct_access_file, Char) f daf = (daf1, c) where c = getnext daf daf1 = set 2 'b'
with a hypothetical format for the direct access file. Now I can certainly implement the first function in Haskell but not the second. Now the only difference between the two functions is the location of the data: in the first the data of the array are in RAM, in the second the data of the direct access file are on disk. There is no other difference. As far as referential integrity is concerened I don't see any difference too. So why can I implement the first function and not the second (well I can use direct access files but I have to change the type of my function.The problem is: I do not see why the location of data should have an influence here.
Haskell values are private to the program, while file contents may be
read and written by other processes.
Haskell computations can be deferred, omitted or duplicated so long as
the program's semantics are preserved, but I/O operations must be
performed as and when specified.
--
Glynn Clements

On Sat, 21 Jun 2003 17:34:59 +0100
Glynn Clements
I do not see why the location of data should have an influence here.
Haskell values are private to the program, while file contents may be read and written by other processes.
Haskell computations can be deferred, omitted or duplicated so long as the program's semantics are preserved, but I/O operations must be performed as and when specified.
There are some special cases where you could get away with it when the IO system gives us enough guarantees. You'd have to be very careful however, to preserve the right semantics. For example if you could mmap() a file such that changes to the underlying file were not reflected in the mmap()d region then you could lazily defer reads from the file. (Unfortunatley MAP_PRIVATE doesn't quite give this.) Duncan
participants (3)
-
Duncan Coutts
-
Glynn Clements
-
naudts guido