node by node copy

Erik Zuurbier F.S.A.Zuurbier@inter.nl.net
Tue, 13 Jan 1998 07:59:21 +0100


Ronny Wichers Schreur wrote (to the Clean discussion list):
>It's not possible to write a general copy function.
>How would you copy a unique world? For example:
>
>    Start :: *World -> (*World, *World)
>    Start world
>        = Copy world
>
>
>You have to write a copy function for your own
>data structures.

If that is really the problem, the type of the Copy-function could be:

Copy :: *a -> (*a,*a) | New a

So we restrict it to structures of which we can create fresh values.
World does NOT belong to that class. Creating new worlds is
Someone else's job.

I am just trying make life easy for the programmer.

Greetings Erik Zuurbier