ghc-8.2.2: The GHC API

Safe Haskell | None
Language | Haskell2010

PipelineMonad

Description

The CompPipeline monad and associated ops

Defined in separate module so that it can safely be imported from Hooks

# Documentation

newtype CompPipeline a #

Constructors

P |

Fields

- unP :: PipeEnv -> PipeState -> IO (PipeState, a)

Instances

Monad CompPipeline # |
Methods (>>=) :: CompPipeline a -> (a -> CompPipeline b) -> CompPipeline b Source # (>>) :: CompPipeline a -> CompPipeline b -> CompPipeline b Source # return :: a -> CompPipeline a Source # fail :: String -> CompPipeline a Source #
Functor CompPipeline # |
Methods fmap :: (a -> b) -> CompPipeline a -> CompPipeline b Source # (<$) :: a -> CompPipeline b -> CompPipeline a Source #
Applicative CompPipeline # |
Methods pure :: a -> CompPipeline a Source # (<*>) :: CompPipeline (a -> b) -> CompPipeline a -> CompPipeline b Source # liftA2 :: (a -> b -> c) -> CompPipeline a -> CompPipeline b -> CompPipeline c Source # (*>) :: CompPipeline a -> CompPipeline b -> CompPipeline b Source # (<*) :: CompPipeline a -> CompPipeline b -> CompPipeline a Source #
MonadIO CompPipeline # |
Methods liftIO :: IO a -> CompPipeline a Source #
HasDynFlags CompPipeline # |
Methods getDynFlags :: CompPipeline DynFlags #

evalP :: CompPipeline a -> PipeEnv -> PipeState -> IO a #

data PhasePlus #

Constructors

RealPhase Phase |
HscOut HscSource ModuleName HscStatus |

Instances

Outputable PhasePlus # |
Methods ppr :: PhasePlus -> SDoc # pprPrec :: Rational -> PhasePlus -> SDoc #

data PipeEnv #

Constructors

PipeEnv |

Fields

- stop_phase :: Phase

  Stop just before this phase

- src_filename :: String

  basename of original input source

- src_basename :: String

  basename of original input source

- src_suffix :: String

  its extension

- output_spec :: PipelineOutput

  says where to put the pipeline output

data PipeState #

Constructors

PipeState |

Fields

- hsc_env :: HscEnv

  only the DynFlags change in the HscEnv. The DynFlags change at various points, for example when we read the OPTIONS_GHC pragmas in the Cpp phase.

- maybe_loc :: Maybe ModLocation

  the ModLocation. This is discovered during compilation, in the Hsc phase where we read the module header.

- foreign_os :: [FilePath]

  additional object files resulting from compiling foreign code. They come from two sources: foreign stubs, and add{C,Cxx,Objc,Objcxx}File from template haskell

data PipelineOutput #

Constructors

Temporary | Output should be to a temporary file: we're going to run more compilation steps on this output later.
Persistent | We want a persistent file, i.e. a file in the current directory derived from the input filename, but with the appropriate extension. eg. in "ghc -c Foo.hs" the output goes into ./Foo.o.
SpecificFile | The output must go into the specific outputFile in DynFlags. We don't store the filename in the constructor as it changes when doing -dynamic-too.

Instances

Show PipelineOutput # |
Methods showsPrec :: Int -> PipelineOutput -> ShowS Source # show :: PipelineOutput -> String Source # showList :: [PipelineOutput] -> ShowS Source #

getPipeEnv :: CompPipeline PipeEnv #

getPipeState :: CompPipeline PipeState #

setDynFlags :: DynFlags -> CompPipeline () #

setModLocation :: ModLocation -> CompPipeline () #

setForeignOs :: [FilePath] -> CompPipeline () #