Safe Haskell | None |
---|---|
Language | Haskell2010 |
Stan.Hie.Compat
Synopsis
- data HieAST a = Node {
- sourcedNodeInfo :: SourcedNodeInfo a
- nodeSpan :: Span
- nodeChildren :: [HieAST a]
- data IEType
- = Import
- | ImportAs
- | ImportHiding
- | Export
- newtype DeclType = DeclType DeclType
- 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 IdentifierDetails a = IdentifierDetails {
- identType :: Maybe a
- identInfo :: Set ContextInfo
- type Identifier = Either ModuleName Name
- data NodeInfo a = NodeInfo {
- nodeAnnotations :: Set NodeAnnotation
- nodeType :: [a]
- nodeIdentifiers :: NodeIdentifiers a
- data NodeAnnotation
- newtype HieASTs a = HieASTs {}
- newtype HieArgs a = HieArgs [(Bool, a)]
- type HieTypeFlat = HieType TypeIndex
- 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 TypeIndex = Int
- data HieFile = HieFile {}
- data HieFileResult
- nodeInfo :: Ord a => HieAST a -> NodeInfo a
- readHieFileWithNameCache :: IO (FilePath -> IO HieFileResult)
- toNodeAnnotation :: NodeAnnotation -> NodeAnnotation
- eqDeclType :: DeclType -> DeclType -> Bool
- hFunTy2 :: HieType b -> Maybe (b, b)
- mkNodeAnnotation :: FastString -> FastString -> NodeAnnotation
- conDec :: DeclType
Documentation
Constructors
Node | |
Fields
|
Instances
Functor HieAST | |
Foldable HieAST | |
Defined in GHC.Iface.Ext.Types Methods 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 | |
Binary (HieAST TypeIndex) | |
Outputable a => Outputable (HieAST a) | |
Defined in GHC.Iface.Ext.Types | |
Show a => Show (HieAST a) # | |
Types of imports and exports
Constructors
Import | |
ImportAs | |
ImportHiding | |
Export |
Instances
Binary IEType | |
Outputable IEType | |
Defined in GHC.Iface.Ext.Types | |
Enum IEType | |
Defined in GHC.Iface.Ext.Types | |
Show IEType # | |
Eq IEType | |
Ord IEType | |
data ContextInfo #
Different contexts under which identifiers exist
Constructors
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 |
Fields
| |
EvidenceVarUse | Usage of evidence variable |
Instances
Binary ContextInfo | |
Defined in GHC.Iface.Ext.Types Methods put_ :: BinHandle -> ContextInfo -> IO () # put :: BinHandle -> ContextInfo -> IO (Bin ContextInfo) # get :: BinHandle -> IO ContextInfo # | |
Outputable ContextInfo | |
Defined in GHC.Iface.Ext.Types Methods ppr :: ContextInfo -> SDoc # | |
Show ContextInfo # | |
Defined in Stan.Hie.Debug908 Methods showsPrec :: Int -> ContextInfo -> ShowS # show :: ContextInfo -> String # showList :: [ContextInfo] -> ShowS # | |
Eq ContextInfo | |
Defined in GHC.Iface.Ext.Types | |
Ord ContextInfo | |
Defined in GHC.Iface.Ext.Types Methods compare :: ContextInfo -> ContextInfo -> Ordering # (<) :: ContextInfo -> ContextInfo -> Bool # (<=) :: ContextInfo -> ContextInfo -> Bool # (>) :: ContextInfo -> ContextInfo -> Bool # (>=) :: ContextInfo -> ContextInfo -> Bool # max :: ContextInfo -> ContextInfo -> ContextInfo # min :: ContextInfo -> ContextInfo -> ContextInfo # |
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)
Constructors
IdentifierDetails | |
Fields
|
Instances
type Identifier = Either ModuleName Name #
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]).
Constructors
NodeInfo | |
Fields
|
Instances
Functor NodeInfo | |
Foldable NodeInfo | |
Defined in GHC.Iface.Ext.Types Methods 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 | |
Binary (NodeInfo TypeIndex) | |
Outputable a => Outputable (NodeInfo a) | |
Defined in GHC.Iface.Ext.Types | |
Show a => Show (NodeInfo a) # | |
data NodeAnnotation #
Instances
Show NodeAnnotation # | |
Defined in Stan.Hie.Compat904 Methods showsPrec :: Int -> NodeAnnotation -> ShowS # show :: NodeAnnotation -> String # showList :: [NodeAnnotation] -> ShowS # | |
Eq NodeAnnotation # | |
Defined in Stan.Hie.Compat904 Methods (==) :: NodeAnnotation -> NodeAnnotation -> Bool # (/=) :: NodeAnnotation -> NodeAnnotation -> Bool # | |
Ord NodeAnnotation # | |
Defined in Stan.Hie.Compat904 Methods compare :: NodeAnnotation -> NodeAnnotation -> Ordering # (<) :: NodeAnnotation -> NodeAnnotation -> Bool # (<=) :: NodeAnnotation -> NodeAnnotation -> Bool # (>) :: NodeAnnotation -> NodeAnnotation -> Bool # (>=) :: NodeAnnotation -> NodeAnnotation -> Bool # max :: NodeAnnotation -> NodeAnnotation -> NodeAnnotation # min :: NodeAnnotation -> NodeAnnotation -> NodeAnnotation # |
Mapping from filepaths to the corresponding AST
Instances
Functor HieASTs | |
Foldable HieASTs | |
Defined in GHC.Iface.Ext.Types Methods 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 | |
Binary (HieASTs TypeIndex) | |
Outputable a => Outputable (HieASTs a) | |
Defined in GHC.Iface.Ext.Types | |
Show a => Show (HieASTs a) # | |
A list of type arguments along with their respective visibilities (ie. is
this an argument that would return True
for isVisibleForAllTyFlag
?).
Instances
Functor HieArgs | |
Foldable HieArgs | |
Defined in GHC.Iface.Ext.Types Methods 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 | |
Binary (HieArgs TypeIndex) | |
Show a => Show (HieArgs a) # | |
Eq a => Eq (HieArgs a) | |
type HieTypeFlat = HieType TypeIndex #
A flattened version of Type
.
See Note [Efficient serialization of redundant type info]
Constructors
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
Functor HieType | |
Foldable HieType | |
Defined in GHC.Iface.Ext.Types Methods 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 | |
Binary (HieType TypeIndex) | |
Show a => Show (HieType a) # | |
Eq a => Eq (HieType a) | |
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.
Constructors
HieFile | |
Fields
|
data HieFileResult #
readHieFileWithNameCache :: IO (FilePath -> IO HieFileResult) #
eqDeclType :: DeclType -> DeclType -> Bool #
mkNodeAnnotation :: FastString -> FastString -> NodeAnnotation #