ghc-mtl-1.2.1.0: An mtl compatible version of the Ghc-Api monads and monad-transformers.

Safe Haskell | None
Language | Haskell98

Control.Monad.Ghc

Synopsis

- data Ghc a
- runGhc :: Maybe FilePath -> Ghc a -> IO a
- data GhcT m a
- runGhcT :: (Functor m, MonadIO m, MonadCatch m, MonadMask m) => Maybe FilePath -> GhcT m a -> m a
- class (Functor m, MonadIO m, ExceptionMonad m, HasDynFlags m) => GhcMonad m where
- module Control.Monad.Trans

# Documentation

data Ghc a Source #

Instances

Monad Ghc Source # |
Methods (>>=) :: Ghc a -> (a -> Ghc b) -> Ghc b # (>>) :: Ghc a -> Ghc b -> Ghc b # return :: a -> Ghc a # fail :: String -> Ghc a #
Functor Ghc Source # |
Methods fmap :: (a -> b) -> Ghc a -> Ghc b # (<$) :: a -> Ghc b -> Ghc a #
Applicative Ghc Source # |
Methods pure :: a -> Ghc a # (<*>) :: Ghc (a -> b) -> Ghc a -> Ghc b # (*>) :: Ghc a -> Ghc b -> Ghc b # (<*) :: Ghc a -> Ghc b -> Ghc a #
MonadIO Ghc Source # |
Methods liftIO :: IO a -> Ghc a #
MonadThrow Ghc Source # |
Methods throwM :: Exception e => e -> Ghc a #
MonadCatch Ghc Source # |
Methods catch :: Exception e => Ghc a -> (e -> Ghc a) -> Ghc a #
MonadMask Ghc Source # |
Methods mask :: ((forall a. Ghc a -> Ghc a) -> Ghc b) -> Ghc b # uninterruptibleMask :: ((forall a. Ghc a -> Ghc a) -> Ghc b) -> Ghc b #
GhcMonad Ghc Source # |
Methods getSession :: Ghc HscEnv # setSession :: HscEnv -> Ghc () #
HasDynFlags Ghc Source # |
Methods getDynFlags :: Ghc DynFlags #
ExceptionMonad Ghc Source # |
Methods gcatch :: Exception e => Ghc a -> (e -> Ghc a) -> Ghc a # gmask :: ((Ghc a -> Ghc a) -> Ghc b) -> Ghc b # gbracket :: Ghc a -> (a -> Ghc b) -> (a -> Ghc c) -> Ghc c # gfinally :: Ghc a -> Ghc b -> Ghc a #

runGhc :: Maybe FilePath -> Ghc a -> IO a Source #

data GhcT m a Source #

Instances

MonadTrans GhcT Source # |
Methods lift :: Monad m => m a -> GhcT m a #
Monad m => Monad (GhcT m) Source # |
Methods (>>=) :: GhcT m a -> (a -> GhcT m b) -> GhcT m b # (>>) :: GhcT m a -> GhcT m b -> GhcT m b # return :: a -> GhcT m a # fail :: String -> GhcT m a #
Functor m => Functor (GhcT m) Source # |
Methods fmap :: (a -> b) -> GhcT m a -> GhcT m b # (<$) :: a -> GhcT m b -> GhcT m a #
(Functor m, Monad m) => Applicative (GhcT m) Source # |
Methods pure :: a -> GhcT m a # (<*>) :: GhcT m (a -> b) -> GhcT m a -> GhcT m b # (*>) :: GhcT m a -> GhcT m b -> GhcT m b # (<*) :: GhcT m a -> GhcT m b -> GhcT m a #
MonadIO m => MonadIO (GhcT m) Source # |
Methods liftIO :: IO a -> GhcT m a #
MonadCatch m => MonadThrow (GhcT m) Source # |
Methods throwM :: Exception e => e -> GhcT m a #
(MonadIO m, MonadCatch m, MonadMask m) => MonadCatch (GhcT m) Source # |
Methods catch :: Exception e => GhcT m a -> (e -> GhcT m a) -> GhcT m a #
(MonadIO m, MonadMask m) => MonadMask (GhcT m) Source # |
Methods mask :: ((forall a. GhcT m a -> GhcT m a) -> GhcT m b) -> GhcT m b # uninterruptibleMask :: ((forall a. GhcT m a -> GhcT m a) -> GhcT m b) -> GhcT m b #
(Functor m, MonadIO m, MonadCatch m, MonadMask m) => GhcMonad (GhcT m) Source # |
Methods getSession :: GhcT m HscEnv # setSession :: HscEnv -> GhcT m () #
MonadIO m => HasDynFlags (GhcT m) Source # |
Methods getDynFlags :: GhcT m DynFlags #
(MonadIO m, MonadCatch m, MonadMask m) => ExceptionMonad (GhcT m) Source # |
Methods gcatch :: Exception e => GhcT m a -> (e -> GhcT m a) -> GhcT m a # gmask :: ((GhcT m a -> GhcT m a) -> GhcT m b) -> GhcT m b # gbracket :: GhcT m a -> (a -> GhcT m b) -> (a -> GhcT m c) -> GhcT m c # gfinally :: GhcT m a -> GhcT m b -> GhcT m a #

runGhcT :: (Functor m, MonadIO m, MonadCatch m, MonadMask m) => Maybe FilePath -> GhcT m a -> m a Source #

class (Functor m, MonadIO m, ExceptionMonad m, HasDynFlags m) => GhcMonad m where #

A monad that has all the features needed by GHC API calls.

In short, a GHC monad

- allows embedding of IO actions,
- can log warnings,
- allows handling of (extensible) exceptions, and
- maintains a current session.

If you do not use `Ghc` or `GhcT`, make sure to call `initGhcMonad` before any call to the GHC API functions can occur.

Minimal complete definition

getSession, setSession

Methods

getSession :: m HscEnv #

setSession :: HscEnv -> m () #

Instances

GhcMonad Ghc |
Methods getSession :: Ghc HscEnv # setSession :: HscEnv -> Ghc () #
GhcMonad Ghc # |
Methods getSession :: Ghc HscEnv # setSession :: HscEnv -> Ghc () #
ExceptionMonad m => GhcMonad (GhcT m) |
Methods getSession :: GhcT m HscEnv # setSession :: HscEnv -> GhcT m () #
(Functor m, MonadIO m, MonadCatch m, MonadMask m) => GhcMonad (GhcT m) # |
Methods getSession :: GhcT m HscEnv # setSession :: HscEnv -> GhcT m () #

module Control.Monad.Trans