Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Thin compatability layer that re-exports things from GHC.
Synopsis
- data BindType
- data ContextInfo
- = Use
- | MatchBind
- | IEThing IEType
- | TyDecl
- | ValBind BindType Scope (Maybe Span)
- | PatternBind Scope Scope (Maybe Span)
- | ClassTyDecl (Maybe Span)
- | Decl DeclType (Maybe Span)
- | TyVarBind Scope TyVarScope
- | RecField RecFieldContext (Maybe Span)
- | EvidenceVarBind EvVarSource Scope (Maybe Span)
- | EvidenceVarUse
- data DeclType
- data HieAST a = Node {
- sourcedNodeInfo :: SourcedNodeInfo a
- nodeSpan :: Span
- nodeChildren :: [HieAST a]
- newtype HieASTs a = HieASTs {}
- data HieFile = HieFile {}
- data HieFileResult = HieFileResult {}
- data HieType a
- type HieTypeFlat = HieType TypeIndex
- type Identifier = Either ModuleName Name
- data IdentifierDetails a = IdentifierDetails {
- identType :: Maybe a
- identInfo :: Set ContextInfo
- data IfaceTyCon = IfaceTyCon {}
- data ModuleName
- data Name
- data NameCache
- data NodeInfo a = NodeInfo {
- nodeAnnotations :: Set NodeAnnotation
- nodeType :: [a]
- nodeIdentifiers :: NodeIdentifiers a
- data RealSrcLoc
- data RealSrcSpan
- data RecFieldContext
- data Scope
- type Span = RealSrcSpan
- type TypeIndex = Int
- availNames :: AvailInfo -> [Name]
- getKey :: Unique -> Int
- getOccString :: NamedThing a => a -> String
- hieVersion :: Integer
- initNameCache :: UniqSupply -> [Name] -> NameCache
- mkSplitUniqSupply :: Char -> IO UniqSupply
- moduleName :: GenModule unit -> ModuleName
- moduleNameString :: ModuleName -> String
- nameUnique :: Name -> Unique
- realSrcSpanEnd :: RealSrcSpan -> RealSrcLoc
- realSrcSpanStart :: RealSrcSpan -> RealSrcLoc
- srcSpanStartCol :: RealSrcSpan -> Int
- srcSpanStartLine :: RealSrcSpan -> Int
- srcSpanEndCol :: RealSrcSpan -> Int
- srcSpanEndLine :: RealSrcSpan -> Int
- srcLocCol :: RealSrcLoc -> Int
- srcLocLine :: RealSrcLoc -> Int
Documentation
Instances
Enum BindType | |
Binary BindType | |
Outputable BindType | |
Defined in GHC.Iface.Ext.Types | |
Eq BindType | |
Ord BindType | |
Defined in GHC.Iface.Ext.Types |
data ContextInfo #
Different contexts under which identifiers exist
Use | regular variable |
MatchBind | |
IEThing IEType | import/export |
TyDecl | |
ValBind | Value binding |
PatternBind | Pattern binding This case is tricky because the bound identifier can be used in two
distinct scopes. Consider the following example (with do (b, a, (a -> True)) <- bar foo a The identifier |
ClassTyDecl (Maybe Span) | |
Decl | Declaration |
TyVarBind Scope TyVarScope | Type variable |
RecField RecFieldContext (Maybe Span) | Record field |
EvidenceVarBind | Constraint/Dictionary evidence variable binding |
| |
EvidenceVarUse | Usage of evidence variable |
Instances
Binary ContextInfo | |
Defined in GHC.Iface.Ext.Types put_ :: BinHandle -> ContextInfo -> IO () # put :: BinHandle -> ContextInfo -> IO (Bin ContextInfo) # get :: BinHandle -> IO ContextInfo # | |
Outputable ContextInfo | |
Defined in GHC.Iface.Ext.Types ppr :: ContextInfo -> SDoc # | |
Eq ContextInfo | |
Defined in GHC.Iface.Ext.Types (==) :: ContextInfo -> ContextInfo -> Bool # (/=) :: ContextInfo -> ContextInfo -> Bool # | |
Ord ContextInfo | |
Defined in GHC.Iface.Ext.Types compare :: ContextInfo -> ContextInfo -> Ordering # (<) :: ContextInfo -> ContextInfo -> Bool # (<=) :: ContextInfo -> ContextInfo -> Bool # (>) :: ContextInfo -> ContextInfo -> Bool # (>=) :: ContextInfo -> ContextInfo -> Bool # max :: ContextInfo -> ContextInfo -> ContextInfo # min :: ContextInfo -> ContextInfo -> ContextInfo # |
FamDec | type or data family |
SynDec | type synonym |
DataDec | data declaration |
ConDec | constructor declaration |
PatSynDec | pattern synonym |
ClassDec | class declaration |
InstDec | instance declaration |
Instances
Enum DeclType | |
Binary DeclType | |
Outputable DeclType | |
Defined in GHC.Iface.Ext.Types | |
Eq DeclType | |
Ord DeclType | |
Defined in GHC.Iface.Ext.Types |
Node | |
|
Instances
Foldable HieAST | |
Defined in GHC.Iface.Ext.Types fold :: Monoid m => HieAST m -> m # foldMap :: Monoid m => (a -> m) -> HieAST a -> m # foldMap' :: Monoid m => (a -> m) -> HieAST a -> m # foldr :: (a -> b -> b) -> b -> HieAST a -> b # foldr' :: (a -> b -> b) -> b -> HieAST a -> b # foldl :: (b -> a -> b) -> b -> HieAST a -> b # foldl' :: (b -> a -> b) -> b -> HieAST a -> b # foldr1 :: (a -> a -> a) -> HieAST a -> a # foldl1 :: (a -> a -> a) -> HieAST a -> a # elem :: Eq a => a -> HieAST a -> Bool # maximum :: Ord a => HieAST a -> a # minimum :: Ord a => HieAST a -> a # | |
Traversable HieAST | |
Functor HieAST | |
Binary (HieAST TypeIndex) | |
Outputable a => Outputable (HieAST a) | |
Defined in GHC.Iface.Ext.Types |
Mapping from filepaths to the corresponding AST
Instances
Foldable HieASTs | |
Defined in GHC.Iface.Ext.Types fold :: Monoid m => HieASTs m -> m # foldMap :: Monoid m => (a -> m) -> HieASTs a -> m # foldMap' :: Monoid m => (a -> m) -> HieASTs a -> m # foldr :: (a -> b -> b) -> b -> HieASTs a -> b # foldr' :: (a -> b -> b) -> b -> HieASTs a -> b # foldl :: (b -> a -> b) -> b -> HieASTs a -> b # foldl' :: (b -> a -> b) -> b -> HieASTs a -> b # foldr1 :: (a -> a -> a) -> HieASTs a -> a # foldl1 :: (a -> a -> a) -> HieASTs a -> a # elem :: Eq a => a -> HieASTs a -> Bool # maximum :: Ord a => HieASTs a -> a # minimum :: Ord a => HieASTs a -> a # | |
Traversable HieASTs | |
Functor HieASTs | |
Binary (HieASTs TypeIndex) | |
Outputable a => Outputable (HieASTs a) | |
Defined in GHC.Iface.Ext.Types |
GHC builds up a wealth of information about Haskell source as it compiles it.
.hie
files are a way of persisting some of this information to disk so that
external tools that need to work with haskell source don't need to parse,
typecheck, and rename all over again. These files contain:
a simplified AST
- nodes are annotated with source positions and types
- identifiers are annotated with scope information
- the raw bytes of the initial Haskell source
Besides saving compilation cycles, .hie
files also offer a more stable
interface than the GHC API.
HieFile | |
|
data HieFileResult #
A flattened version of Type
.
See Note [Efficient serialization of redundant type info]
HTyVarTy Name | |
HAppTy a (HieArgs a) | |
HTyConApp IfaceTyCon (HieArgs a) | |
HForAllTy ((Name, a), ArgFlag) a | |
HFunTy a a a | |
HQualTy a a | type with constraint: |
HLitTy IfaceTyLit | |
HCastTy a | |
HCoercionTy |
Instances
Foldable HieType | |
Defined in GHC.Iface.Ext.Types fold :: Monoid m => HieType m -> m # foldMap :: Monoid m => (a -> m) -> HieType a -> m # foldMap' :: Monoid m => (a -> m) -> HieType a -> m # foldr :: (a -> b -> b) -> b -> HieType a -> b # foldr' :: (a -> b -> b) -> b -> HieType a -> b # foldl :: (b -> a -> b) -> b -> HieType a -> b # foldl' :: (b -> a -> b) -> b -> HieType a -> b # foldr1 :: (a -> a -> a) -> HieType a -> a # foldl1 :: (a -> a -> a) -> HieType a -> a # elem :: Eq a => a -> HieType a -> Bool # maximum :: Ord a => HieType a -> a # minimum :: Ord a => HieType a -> a # | |
Traversable HieType | |
Functor HieType | |
Binary (HieType TypeIndex) | |
Eq a => Eq (HieType a) | |
type HieTypeFlat = HieType TypeIndex #
type Identifier = Either ModuleName Name #
data IdentifierDetails a #
Information associated with every identifier
We need to include types with identifiers because sometimes multiple identifiers occur in the same span(Overloaded Record Fields and so on)
Instances
data IfaceTyCon #
Instances
NFData IfaceTyCon | |
Defined in GHC.Iface.Type rnf :: IfaceTyCon -> () # | |
Binary IfaceTyCon | |
Defined in GHC.Iface.Type put_ :: BinHandle -> IfaceTyCon -> IO () # put :: BinHandle -> IfaceTyCon -> IO (Bin IfaceTyCon) # get :: BinHandle -> IO IfaceTyCon # | |
Outputable IfaceTyCon | |
Defined in GHC.Iface.Type ppr :: IfaceTyCon -> SDoc # | |
Eq IfaceTyCon | |
Defined in GHC.Iface.Type (==) :: IfaceTyCon -> IfaceTyCon -> Bool # (/=) :: IfaceTyCon -> IfaceTyCon -> Bool # |
data ModuleName #
A ModuleName is essentially a simple string, e.g. Data.List
.
Instances
A unique, unambiguous name for something, containing information about where that thing originated.
Instances
Data Name | |
Defined in GHC.Types.Name gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Name -> c Name # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Name # dataTypeOf :: Name -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Name) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Name) # gmapT :: (forall b. Data b => b -> b) -> Name -> Name # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r # gmapQ :: (forall d. Data d => d -> u) -> Name -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Name -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Name -> m Name # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Name -> m Name # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Name -> m Name # | |
NFData Name | |
Defined in GHC.Types.Name | |
NamedThing Name | |
Defined in GHC.Types.Name | |
HasOccName Name | |
Defined in GHC.Types.Name | |
Uniquable Name | |
Defined in GHC.Types.Name | |
Binary Name | Assumes that the |
Outputable Name | |
Defined in GHC.Types.Name | |
OutputableBndr Name | |
Defined in GHC.Types.Name pprBndr :: BindingSite -> Name -> SDoc # pprPrefixOcc :: Name -> SDoc # pprInfixOcc :: Name -> SDoc # bndrIsJoin_maybe :: Name -> Maybe Int # | |
Eq Name | |
Ord Name | Caution: This instance is implemented via See |
type Anno Name | |
Defined in GHC.Hs.Extension | |
type Anno (LocatedN Name) | |
Defined in GHC.Hs.Binds | |
type Anno [LocatedN Name] | |
Defined in GHC.Hs.Binds |
The NameCache makes sure that there is just one Unique assigned for each original name; i.e. (module-name, occ-name) pair and provides something of a lookup mechanism for those names.
The information stored in one AST node.
The type parameter exists to provide flexibility in representation of types (see Note [Efficient serialization of redundant type info]).
NodeInfo | |
|
Instances
Foldable NodeInfo | |
Defined in GHC.Iface.Ext.Types fold :: Monoid m => NodeInfo m -> m # foldMap :: Monoid m => (a -> m) -> NodeInfo a -> m # foldMap' :: Monoid m => (a -> m) -> NodeInfo a -> m # foldr :: (a -> b -> b) -> b -> NodeInfo a -> b # foldr' :: (a -> b -> b) -> b -> NodeInfo a -> b # foldl :: (b -> a -> b) -> b -> NodeInfo a -> b # foldl' :: (b -> a -> b) -> b -> NodeInfo a -> b # foldr1 :: (a -> a -> a) -> NodeInfo a -> a # foldl1 :: (a -> a -> a) -> NodeInfo a -> a # elem :: Eq a => a -> NodeInfo a -> Bool # maximum :: Ord a => NodeInfo a -> a # minimum :: Ord a => NodeInfo a -> a # | |
Traversable NodeInfo | |
Functor NodeInfo | |
Binary (NodeInfo TypeIndex) | |
Outputable a => Outputable (NodeInfo a) | |
Defined in GHC.Iface.Ext.Types |
data RealSrcLoc #
Real Source Location
Represents a single point within a file
Instances
Show RealSrcLoc | |
Defined in GHC.Types.SrcLoc showsPrec :: Int -> RealSrcLoc -> ShowS # show :: RealSrcLoc -> String # showList :: [RealSrcLoc] -> ShowS # | |
Outputable RealSrcLoc | |
Defined in GHC.Types.SrcLoc ppr :: RealSrcLoc -> SDoc # | |
Eq RealSrcLoc | |
Defined in GHC.Types.SrcLoc (==) :: RealSrcLoc -> RealSrcLoc -> Bool # (/=) :: RealSrcLoc -> RealSrcLoc -> Bool # | |
Ord RealSrcLoc | |
Defined in GHC.Types.SrcLoc compare :: RealSrcLoc -> RealSrcLoc -> Ordering # (<) :: RealSrcLoc -> RealSrcLoc -> Bool # (<=) :: RealSrcLoc -> RealSrcLoc -> Bool # (>) :: RealSrcLoc -> RealSrcLoc -> Bool # (>=) :: RealSrcLoc -> RealSrcLoc -> Bool # max :: RealSrcLoc -> RealSrcLoc -> RealSrcLoc # min :: RealSrcLoc -> RealSrcLoc -> RealSrcLoc # |
data RealSrcSpan #
A SrcSpan
delimits a portion of a text file. It could be represented
by a pair of (line,column) coordinates, but in fact we optimise
slightly by using more compact representations for single-line and
zero-length spans, both of which are quite common.
The end position is defined to be the column after the end of the span. That is, a span of (1,1)-(1,2) is one character long, and a span of (1,1)-(1,1) is zero characters long.
Real Source Span
Instances
data RecFieldContext #
Instances
Instances
Data Scope | |
Defined in GHC.Iface.Ext.Types gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Scope -> c Scope # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Scope # dataTypeOf :: Scope -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Scope) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Scope) # gmapT :: (forall b. Data b => b -> b) -> Scope -> Scope # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Scope -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Scope -> r # gmapQ :: (forall d. Data d => d -> u) -> Scope -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Scope -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Scope -> m Scope # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Scope -> m Scope # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Scope -> m Scope # | |
Binary Scope | |
Outputable Scope | |
Defined in GHC.Iface.Ext.Types | |
Eq Scope | |
Ord Scope | |
type Span = RealSrcSpan #
availNames :: AvailInfo -> [Name] #
All names made available by the availability information (excluding overloaded selectors)
getOccString :: NamedThing a => a -> String #
hieVersion :: Integer #
Current version of .hie
files
initNameCache :: UniqSupply -> [Name] -> NameCache #
Return a function to atomically update the name cache.
mkSplitUniqSupply :: Char -> IO UniqSupply #
Create a unique supply out of thin air. The "mask" (Char) supplied is purely cosmetic, making it easier to figure out where a Unique was born. See Note [Uniques and masks].
The payload part of the Uniques allocated from this UniqSupply are
guaranteed distinct wrt all other supplies, regardless of their "mask".
This is achieved by allocating the payload part from
a single source of Uniques, namely genSym
, shared across
all UniqSupply's.
moduleName :: GenModule unit -> ModuleName #
Module name (e.g. A.B.C)
moduleNameString :: ModuleName -> String #
nameUnique :: Name -> Unique #
realSrcSpanEnd :: RealSrcSpan -> RealSrcLoc #
srcSpanStartCol :: RealSrcSpan -> Int #
srcSpanStartLine :: RealSrcSpan -> Int #
srcSpanEndCol :: RealSrcSpan -> Int #
srcSpanEndLine :: RealSrcSpan -> Int #
srcLocCol :: RealSrcLoc -> Int #
Raises an error when used on a "bad" SrcLoc
srcLocLine :: RealSrcLoc -> Int #
Raises an error when used on a "bad" SrcLoc