Safe Haskell | None |
---|---|
Language | Haskell2010 |
The transformation monad carries the necessary information that is passed top-down during the conversion from GHC AST to our representation.
- type Trf = ReaderT TrfInput Ghc
- data TrfInput = TrfInput {
- srcMap :: SourceMap
- pragmaComms :: Map String [Located String]
- declsToInsert :: [Ann Decl (Dom RdrName) RangeStage]
- contRange :: SrcSpan
- localsInScope :: [[Name]]
- defining :: Bool
- definingTypeVars :: Bool
- originalNames :: Map SrcSpan RdrName
- declSplices :: [Located (HsSplice Name)]
- typeSplices :: [HsSplice Name]
- exprSplices :: [HsSplice Name]
- trfInit :: Map ApiAnnKey [SrcSpan] -> Map String [Located String] -> TrfInput
- liftGhc :: Ghc a -> Trf a
- define :: Trf a -> Trf a
- defineTypeVars :: Trf a -> Trf a
- typeVarTransform :: Trf a -> Trf a
- transformingPossibleVar :: HsHasName n => n -> Trf a -> Trf a
- addToScope :: HsHasName e => e -> Trf a -> Trf a
- addToCurrentScope :: HsHasName e => e -> Trf a -> Trf a
- runTrf :: Map ApiAnnKey [SrcSpan] -> Map String [Located String] -> Trf a -> Ghc a
- setOriginalNames :: Map SrcSpan RdrName -> Trf a -> Trf a
- getOriginalName :: RdrName -> Trf String
- setSplices :: [Located (HsSplice Name)] -> [HsSplice Name] -> [HsSplice Name] -> Trf a -> Trf a
- setDeclsToInsert :: [Ann Decl (Dom RdrName) RangeStage] -> Trf a -> Trf a
- exprSpliceInserted :: HsSplice Name -> Trf a -> Trf a
- typeSpliceInserted :: HsSplice Name -> Trf a -> Trf a
- getSpliceLoc :: HsSplice a -> SrcSpan
Documentation
The (immutable) data for the transformation
TrfInput | |
|
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
getSpliceLoc :: HsSplice a -> SrcSpan Source #