haskell-tools-ast-fromghc-0.2.0.0: Creating the Haskell-Tools AST from GHC's representations

Safe HaskellNone
LanguageHaskell2010

Language.Haskell.Tools.AST.FromGHC.Monad

Description

The transformation monad carries the necessary information that is passed top-down during the conversion from GHC AST to our representation.

Synopsis

Documentation

type Trf = ReaderT TrfInput Ghc Source #

The transformation monad type

data TrfInput Source #

The (immutable) data for the transformation

Constructors

TrfInput 

Fields

liftGhc :: Ghc a -> Trf a Source #

define :: Trf a -> Trf a Source #

Perform the transformation taking names as defined.

defineTypeVars :: Trf a -> Trf a Source #

Perform the transformation taking type variable names as defined.

typeVarTransform :: Trf a -> Trf a Source #

Transform as type variables

transformingPossibleVar :: HsHasName n => n -> Trf a -> Trf a Source #

Transform a name as a type variable if it is one.

addToScope :: HsHasName e => e -> Trf a -> Trf a Source #

Perform the transformation putting the given definition in a new local scope.

addToCurrentScope :: HsHasName e => e -> Trf a -> Trf a Source #

Perform the transformation putting the given definitions in the current scope.

runTrf :: Map ApiAnnKey [SrcSpan] -> Map String [Located String] -> Trf a -> Ghc a Source #

Performs the transformation given the tokens of the source file

getOriginalName :: RdrName -> Trf String Source #

Get the original format of a name (before scoping).

setSplices :: [Located (HsSplice Name)] -> [HsSplice Name] -> [HsSplice Name] -> Trf a -> Trf a Source #

Set splices that must replace the elements that are generated into the AST representation.

setDeclsToInsert :: [Ann Decl (Dom RdrName) RangeStage] -> Trf a -> Trf a Source #

Set the list of declarations that will be missing from AST