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 :: Type -> Type) where
  - getSession :: m HscEnv
  - setSession :: HscEnv -> m ()
- module Control.Monad.Trans
- module Control.Monad.Trans

# Documentation

data Ghc a Source #

#### Instances

Instances details

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

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

data GhcT m a Source #

#### Instances

Instances details

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

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 :: Type -> Type) where Source #

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.

Methods

getSession :: m HscEnv Source #

setSession :: HscEnv -> m () Source #

#### Instances

Instances details

GhcMonad Ghc |
Instance details Defined in GhcMonad Methods getSession :: Ghc HscEnv Source # setSession :: HscEnv -> Ghc () Source #
GhcMonad Ghc Source # |
Instance details Defined in Control.Monad.Ghc Methods getSession :: Ghc HscEnv Source # setSession :: HscEnv -> Ghc () Source #
ExceptionMonad m => GhcMonad (GhcT m) |
Instance details Defined in GhcMonad Methods getSession :: GhcT m HscEnv Source # setSession :: HscEnv -> GhcT m () Source #
(Functor m, MonadIO m, MonadCatch m, MonadMask m) => GhcMonad (GhcT m) Source # |
Instance details Defined in Control.Monad.Ghc Methods getSession :: GhcT m HscEnv Source # setSession :: HscEnv -> GhcT m () Source #

module Control.Monad.Trans

module Control.Monad.Trans