Hi Corentin, corentin.dup...@ext.mpsa.com schrieb:
for GHCi, i will try an IORef. Too bad i allready coded it using "StateT GameState IO ()" extensively through the code ;)
That shouldn't be a problem, you could switch back and forth in submitRule, approximately like this:
startGame :: IO (Rule -> IO ()) startGame = do gameState <- newIORef initialState return (\rule -> wrapStateT (submitRule rule) gameState) wrapStateT :: StateT s IO a -> IORef s -> IO a wrapStateT action ref = do state <- readIORef ref (answer, state) <- runStateT action state writeIORef ref state return answer Now you can start a game with mySubmitRule <- startGame and use mySubmitRule at the ghci prompt afterwards. Tillmann _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe