[clean-list] Wish list =+ New *World

Andrew Butterfield Andrew.Butterfield at cs.tcd.ie
Thu Aug 23 10:44:26 MEST 2007


Shivkumar Chandrasekaran wrote:
> Resuming my previous thread on access to external commands in Clean.
> 
> It would be really nice to have access to a function like (createWorld 
> :: *World) that returned a brand new world (equivalent to say a new 
> partition on the hard disk) but more like how createArray returns a 
> fresh unique array. It seems it would be really nice to live in a many 
> worlds universe :-)

As Edsko said - this is not really doable, but...

> 
> Similarly, in my work (numerical solution of PDEs), I often need to 
> manipulate large quantities of intermediate data (matrix factorizations, 
> and so forth), which I would like to store in external files rather than 
> in memory. Even though these calculations are deep inside my code, I 
> must still thread *World all the way in. Again, it would be nice not to 
> have to do that. 

... what you actually seem to want to do may actually be do-able.

Clean's I/O system (unlike Haskell's) allows you to break up the world 
at the start of a program and assemble it later on.

You can pull out the filesystem from the world, and then open individual
files for reading and writing and then pass these file handles to the 
functions that want to process external data. You do not need to thread
world down to every part of the program that wants to do I/O - only the
file handles relevant to that part need be passed. This is  in contrast
to haskell's I/O system where the IO monad has to "go everywhere that IO 
occurs".


More information about the clean-list mailing list