diff options
Diffstat (limited to 'compiler/GHC/Driver/Monad/Interactive.hs')
| -rw-r--r-- | compiler/GHC/Driver/Monad/Interactive.hs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/compiler/GHC/Driver/Monad/Interactive.hs b/compiler/GHC/Driver/Monad/Interactive.hs new file mode 100644 index 0000000000..b37a612a83 --- /dev/null +++ b/compiler/GHC/Driver/Monad/Interactive.hs @@ -0,0 +1,21 @@ +module GHC.Driver.Monad.Interactive where + +import GHC.Prelude + +import GHC.Driver.Monad ( GhcMonad ) +import GHC.Runtime.Context ( InteractiveContext ) + +class GhcMonad m => GhciMonad m where + getInteractiveContext :: m InteractiveContext + + setInteractiveContext :: InteractiveContext -> m () + + modifyInteractiveContext :: (InteractiveContext -> InteractiveContext) -> m () + modifyInteractiveContext f = do + m <- getInteractiveContext + setInteractiveContext $ f m + +modifyInteractiveContextM :: GhciMonad m => (InteractiveContext -> m InteractiveContext) -> m () +modifyInteractiveContextM f = do + m <- getInteractiveContext + setInteractiveContext =<< f m |
