[Haskell-cafe] Re: global variables

Big Chris ccasingh at andrew.cmu.edu
Thu May 17 22:06:29 EDT 2007


On Thu, 17 May 2007, Jason Dagit wrote:

> Well, it seems to me that Haskell modules are actually very similar to
> singletons. Perhaps all these problems with modules having top level
> mutable state could be solved if Haskell modules were parameterizable
> at "instantiation"?  I'm not saying we should turn the Haskell module
> system into an OO system, just that maybe it would be wise to borrow
> some ideas from that paradigm.

Well, I'm a little unclear as to how the discussion shifted from
global variables to modules, but as long as we're here: Rather than
looking at OO languages, why not take a lesson from more powerful
module systems already in functional programming languages.  In
particular, the ML module system supports "parameterization at
instantiation" with functors.  Of course, there is considerable
evidence that ML modules and Haskell type classes really do the same
thing, but they do seem to be useful in very different situations.

--Chris


More information about the Haskell-Cafe mailing list