[Haskell-cafe] Current situation regarding global IORefs

John Meacham john at repetae.net
Thu Apr 27 17:24:48 EDT 2006


On Thu, Apr 27, 2006 at 09:53:35PM +0100, Brian Hulley wrote:
> At the moment, there is a strange unnatural discrepancy between the fixed 
> set of built-in privileged operations such as newUnique which are "allowed" 
> to make use of global state and user defined operations which have to rely 
> on a shaky hack in order to preserve natural abstraction barriers between 
> components such as a user-defined Unique, Atom, and anything involving 
> memoisation or device management etc.

In fact, you reminded me of the so obvious it is easy to forget example
of global state that every haskell programer uses since day one.

CAFs.
as in

fibs = 0 : 1 : zipWith (+) fibs (tail fibs)

fibs is mutable global state that is updated with its value when it is
evaluated.

not sure how I missed the obvious example.

        John




-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the Haskell-Cafe mailing list