Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- 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
- newtype HieArgs a = HieArgs [(Bool, a)]
- data HieAST a = Node {
- sourcedNodeInfo :: SourcedNodeInfo a
- nodeSpan :: Span
- nodeChildren :: [HieAST a]
- newtype HieASTs a = HieASTs {}
- data HieFile = HieFile {}
- data HieType a
- = HTyVarTy Name
- | HAppTy a (HieArgs a)
- | HTyConApp IfaceTyCon (HieArgs a)
- | HForAllTy ((Name, a), ForAllTyFlag) a
- | HFunTy a a a
- | HQualTy a a
- | HLitTy IfaceTyLit
- | HCastTy a
- | HCoercionTy
- type HieTypeFlat = HieType TypeIndex
- data IEType
- = Import
- | ImportAs
- | ImportHiding
- | Export
- type Identifier = Either ModuleName Name
- data IdentifierDetails a = IdentifierDetails {
- identType :: Maybe a
- identInfo :: Set ContextInfo
- data NodeInfo a = NodeInfo {
- nodeAnnotations :: Set NodeAnnotation
- nodeType :: [a]
- nodeIdentifiers :: NodeIdentifiers a
- type TypeIndex = Int
- newtype DeclType = DeclType DeclType
- hFunTy2 :: HieType b -> Maybe (b, b)
- conDec :: DeclType
- eqDeclType :: DeclType -> DeclType -> Bool
- data NodeAnnotation
- mkNodeAnnotation :: FastString -> FastString -> NodeAnnotation
- toNodeAnnotation :: NodeAnnotation -> NodeAnnotation
- data HieFileResult
- readHieFileWithNameCache :: IO (FilePath -> IO HieFileResult)
- nodeInfo :: Ord a => HieAST a -> NodeInfo a
Main HIE 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
Show ContextInfo Source # | |
Defined in Stan.Hie.Debug902 showsPrec :: Int -> ContextInfo -> ShowS # show :: ContextInfo -> String # showList :: [ContextInfo] -> ShowS # | |
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 # |
A list of type arguments along with their respective visibilities (ie. is
this an argument that would return True
for isVisibleForAllTyFlag
?).
Instances
Foldable HieArgs | |
Defined in GHC.Iface.Ext.Types fold :: Monoid m => HieArgs m -> m # foldMap :: Monoid m => (a -> m) -> HieArgs a -> m # foldMap' :: Monoid m => (a -> m) -> HieArgs a -> m # foldr :: (a -> b -> b) -> b -> HieArgs a -> b # foldr' :: (a -> b -> b) -> b -> HieArgs a -> b # foldl :: (b -> a -> b) -> b -> HieArgs a -> b # foldl' :: (b -> a -> b) -> b -> HieArgs a -> b # foldr1 :: (a -> a -> a) -> HieArgs a -> a # foldl1 :: (a -> a -> a) -> HieArgs a -> a # elem :: Eq a => a -> HieArgs a -> Bool # maximum :: Ord a => HieArgs a -> a # minimum :: Ord a => HieArgs a -> a # | |
Traversable HieArgs | |
Functor HieArgs | |
Show a => Show (HieArgs a) Source # | |
Binary (HieArgs TypeIndex) | |
Eq a => Eq (HieArgs a) | |
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 | |
Show a => Show (HieAST a) Source # | |
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 | |
Show a => Show (HieASTs a) Source # | |
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 | |
|
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), ForAllTyFlag) 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 | |
Show a => Show (HieType a) Source # | |
Binary (HieType TypeIndex) | |
Eq a => Eq (HieType a) | |
type HieTypeFlat = HieType TypeIndex #
Types of imports and exports
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
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 | |
Show a => Show (NodeInfo a) Source # | |
Binary (NodeInfo TypeIndex) | |
Outputable a => Outputable (NodeInfo a) | |
Defined in GHC.Iface.Ext.Types |
data NodeAnnotation Source #
Instances
Show NodeAnnotation Source # | |
Defined in Stan.Hie.Compat904 showsPrec :: Int -> NodeAnnotation -> ShowS # show :: NodeAnnotation -> String # showList :: [NodeAnnotation] -> ShowS # | |
Eq NodeAnnotation Source # | |
Defined in Stan.Hie.Compat904 (==) :: NodeAnnotation -> NodeAnnotation -> Bool # (/=) :: NodeAnnotation -> NodeAnnotation -> Bool # | |
Ord NodeAnnotation Source # | |
Defined in Stan.Hie.Compat904 compare :: NodeAnnotation -> NodeAnnotation -> Ordering # (<) :: NodeAnnotation -> NodeAnnotation -> Bool # (<=) :: NodeAnnotation -> NodeAnnotation -> Bool # (>) :: NodeAnnotation -> NodeAnnotation -> Bool # (>=) :: NodeAnnotation -> NodeAnnotation -> Bool # max :: NodeAnnotation -> NodeAnnotation -> NodeAnnotation # min :: NodeAnnotation -> NodeAnnotation -> NodeAnnotation # |
Binary interface to hie files
data HieFileResult #
readHieFileWithNameCache :: IO (FilePath -> IO HieFileResult) Source #