Global variables

Ashley Yakeley ashley@semantic.org
Thu, 29 Nov 2001 11:13:04 -0800


At 2001-11-29 05:31, Juan Ignacio Garc=EDa Garc=EDa wrote:

>I am interested in using global variables (in GHC). 

In JVM-Bridge (nearly there!) I use lifted monads to store global 
constants, though variables are not hard either. This does mean an extra 
function needed to call IO functions, but in my case you'd be calling 
mostly my glue functions to Java code, which are in the lifted monad 
anyway.

Lifted monads look something like this:

     data MyAction a =3D MkMyAction ((consts,vars) -> (vars,a));
     instance Monad MyAction where etc.

I actually have a class for monads that lift the IO monad:

<http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/~checkout~/jvm-bridge/sourc
e/Haskell/IOLiftedMonad.hs?rev=3DHEAD&content-type=3Dtext/plain>

-- 
Ashley Yakeley, Seattle WA