[Haskell] Re: Global Variables and IO initializers

Koen Claessen koen at cs.chalmers.se
Fri Nov 5 05:28:06 EST 2004


Benjamin Franksen wrote:

 | > I think hiding the fact that certain objects are not
 | > constants but functions is a bad idea, because it will break
 | > sharing in a lazy implementation.
 |
 | You probably mean the case where the implicit parameter
 | is the only one. I don't see why that would "break
 | sharing in a lazy implementation". The compiler is fully
 | aware of the complete type of all functions and can use
 | sharing whenever appropriate.

Maybe you misunderstood me. What about:

  x :: Int
  x = expensive ?foo

The type of x makes it look like a value that can be shared.
But really it cannot since it depends on ?foo. How can a
compiler share different uses of x?

/Koen


More information about the Haskell mailing list