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

Safe Haskell | None

Control.Monad.Ghc

Synopsis

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

# Documentation

data Ghc a Source

Instances

Monad Ghc |
Functor Ghc |
MonadCatchIO Ghc |
GhcMonad Ghc |
HasDynFlags Ghc |
ExceptionMonad Ghc |
MonadIO Ghc |
MonadIO Ghc |

runGhc :: Maybe FilePath -> Ghc a -> IO aSource

data GhcT m a Source

Instances

MonadTrans GhcT |
Monad m => Monad (GhcT m) |
Functor m => Functor (GhcT m) |
MonadCatchIO m => MonadCatchIO (GhcT m) |
(Functor m, MonadCatchIO m) => GhcMonad (GhcT m) |
(Functor m, MonadCatchIO m) => HasDynFlags (GhcT m) |
MonadCatchIO m => ExceptionMonad (GhcT m) |
MonadIO m => MonadIO (GhcT m) |
MonadIO m => MonadIO (GhcT m) |

runGhcT :: (Functor m, MonadCatchIO m) => Maybe FilePath -> GhcT m a -> m aSource

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.

Methods

getSession :: m HscEnv

setSession :: HscEnv -> m ()

Instances

GhcMonad Ghc |
GhcMonad Ghc |
(Functor m, ExceptionMonad m, MonadIO m) => GhcMonad (GhcT m) |
(Functor m, MonadCatchIO m) => GhcMonad (GhcT m) |

module Control.Monad.Trans