Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type SessionMonad m = (GhcMonad m, MonadMask m, MonadCatch m)
- run :: (MonadIO m, MonadMask m, Functor m) => GhcT m a -> m a
- runWith :: Config -> Ghc a -> IO a
- setStrFlags :: GhcMonad m => [String] -> m ()
- type Import = String
- setImports :: GhcMonad m => [Import] -> m ()
- withImports :: (MonadMask m, GhcMonad m) => [Import] -> m a -> m a
- setFlags :: GhcMonad m => [ExtensionFlag] -> m ()
- unsetFlags :: GhcMonad m => [ExtensionFlag] -> m ()
- withExtensionFlags :: (MonadMask m, GhcMonad m) => [ExtensionFlag] -> [ExtensionFlag] -> m a -> m a
- runStmt :: (MonadCatch m, GhcMonad m) => String -> m ()
- runDecls :: (MonadCatch m, GhcMonad m) => String -> m ()
- runAssignment :: (MonadCatch m, GhcMonad m) => String -> String -> m ()
- runAssignment' :: (MonadCatch m, GhcMonad m) => String -> String -> m ()
- interpret :: (MonadCatch m, GhcMonad m) => Typeable a => String -> m a
- sandboxDynFlags :: (MonadMask m, GhcMonad m) => m a -> m a
- sandboxContext :: (MonadMask m, GhcMonad m) => m a -> m a
- interceptErrors :: (MonadCatch m, GhcMonad m) => m a -> m a
Session
type SessionMonad m = (GhcMonad m, MonadMask m, MonadCatch m) Source
run :: (MonadIO m, MonadMask m, Functor m) => GhcT m a -> m a Source
Run a session with default config.
Flags
setStrFlags :: GhcMonad m => [String] -> m () Source
Set ghc command line arguments.
Imports
setImports :: GhcMonad m => [Import] -> m () Source
Set imports and replace existing ones.
withImports :: (MonadMask m, GhcMonad m) => [Import] -> m a -> m a Source
Run a code with temporary imports.
GHC extensions
setFlags :: GhcMonad m => [ExtensionFlag] -> m () Source
Set GHC extension flags.
unsetFlags :: GhcMonad m => [ExtensionFlag] -> m () Source
Unset GHC extension flags.
withExtensionFlags :: (MonadMask m, GhcMonad m) => [ExtensionFlag] -> [ExtensionFlag] -> m a -> m a Source
Run a code with temporary GHC extension flags.
Expression evaluation
runStmt :: (MonadCatch m, GhcMonad m) => String -> m () Source
Run a statement as in ghci.
runDecls :: (MonadCatch m, GhcMonad m) => String -> m () Source
Run declarations as in Haskell source file.
runAssignment :: (MonadCatch m, GhcMonad m) => String -> String -> m () Source
Bind an expression to a variable using `let` syntax.
runAssignment' :: (MonadCatch m, GhcMonad m) => String -> String -> m () Source
Bind an expression to a variable using bind
syntax. Expression must have type `IO a`.
interpret :: (MonadCatch m, GhcMonad m) => Typeable a => String -> m a Source
Evaluate an expression.
Context and DynFlags protection
sandboxDynFlags :: (MonadMask m, GhcMonad m) => m a -> m a Source
Run a code which can safely modify DynFlags - it will be restored on exit.
sandboxContext :: (MonadMask m, GhcMonad m) => m a -> m a Source
Run a code which can safely modify Context - it will be restored on exit.
interceptErrors :: (MonadCatch m, GhcMonad m) => m a -> m a Source
Restore session when exception will be raised.