[Haskell-cafe] StateT IO Action on `onKeyPress`

2009-05-03 Thread Andy Stewart
Hi all, I have a function named `keymapTest` need moand state WindowListT, and WindowListT is `type WindowListT = StateT WindowList IO`. when i add "(\event -> keymapTest winList event >> return False)" after `onKeyPress` for handle key press event, i got GHC error: Manatee.hs:57:58: Couldn'

Re: [Haskell-cafe] StateT IO Action on `onKeyPress`

2009-05-03 Thread Ryan Ingram
Hi Andy. The GTK bindings use IO for their callbacks, not any custom monad like your WindowListT. I suggest, instead of StateT s IO a, you use ReaderT (IORef s) IO a: putR :: s -> ReaderT (IORef s) IO () putR s = do r <- ask liftIO $ writeIORef r s getR :: ReaderT (IORef s) IO s getR =