[...] Unfortunately, it's not going to work. It's not going to work because some of the procedures take callbacks, and the callbacks are values of type IO (). I can see two solutions to this:
a) revert to using an IORef [...] b) write the callbacks as values of type StateT Env IO () [...]
or
c) Give up any hope of clean semantics and simply use a common hack like:
{-# NOINLINE myGlobalVar #-}
myGlobalVar :: IORef Int
myGlobalVar = unsafePerformIO (newIORef 0)My GLUT binding does it happily, as does GHC itself, just look for NOINLINE pragmas in the following files: :-]
http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/libraries/GLUT/Graphics/UI/GLUT/Callbacks/Registration.hs?rev=1.12 http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/libraries/GLUT/Graphics/UI/GLUT/Menu.hs?rev=1.13 http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/ghc/compiler/HsVersions.h?rev=1.35
Cheers, S. _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
