
#9966: Allow switching to different monads in GHCi -------------------------------------+------------------------------------- Reporter: gridaphobe | Owner: Type: feature | Status: new request | Milestone: Priority: low | Version: 7.11 Component: GHCi | Operating System: Unknown/Multiple Keywords: | Type of failure: None/Unknown Architecture: | Blocked By: Unknown/Multiple | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- GHCi can evaluate individual `IO` actions, e.g. {{{ ghci> writeFile "foo.txt" "bar" ghci> readFile "foo.txt" bar }}} but, as far as I know, this doesn't extend to other monads. Instead you have to compose an entire computation and then run it with the standard eliminators, e.g. {{{ ghci> evalState 0 (put 1 >> get) 1 }}} It would be quite nice if we could tell GHCi to temporarily jump into a different top-level monad, e.g. {{{ -- we start in IO as usual ghci> :monad runState 0 -- now we're in `State Int` with the initial state set to 0 ghci> put 1 -- we can evaluate individual State actions without the ceremony of `runState`, -- and having to track the updated state ourselves between actions ghci> get 1 ghci> :monad IO -- now we're back in IO }}} I'm not sure how feasible this is (it seems tricky), but it would provide a very nice UX for GHCi in the context of larger Haskell applications. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9966 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler