Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type Span = RealSrcSpan
- curHieVersion :: Word8
- data HieFile = HieFile {}
- type TypeIndex = Int
- data HieType a
- type HieTypeFlat = HieType TypeIndex
- newtype HieTypeFix = Roll (HieType HieTypeFix)
- newtype HieArgs a = HieArgs [(Bool, a)]
- newtype HieASTs a = HieASTs {
- getAsts :: Map FastString (HieAST a)
- data HieAST a = Node {}
- data NodeInfo a = NodeInfo {
- nodeAnnotations :: Set (FastString, FastString)
- nodeType :: [a]
- nodeIdentifiers :: NodeIdentifiers a
- type Identifier = Either ModuleName Name
- type NodeIdentifiers a = Map Identifier (IdentifierDetails a)
- data IdentifierDetails a = IdentifierDetails {
- identType :: Maybe a
- identInfo :: Set ContextInfo
- data ContextInfo
- data IEType
- = Import
- | ImportAs
- | ImportHiding
- | Export
- data RecFieldContext
- data BindType
- data DeclType
- data Scope
- data TyVarScope
- = ResolvedScopes [Scope]
- | UnresolvedScope [Name] (Maybe Span)
Documentation
type Span = RealSrcSpan Source #
curHieVersion :: Word8 Source #
Current version of .hie
files
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), ArgFlag) a | |
HFunTy a a | |
HQualTy a a | type with constraint: |
HLitTy IfaceTyLit | |
HCastTy a | |
HCoercionTy |
Instances
Functor HieType Source # | |
Foldable HieType Source # | |
Defined in HieTypes fold :: Monoid m => HieType m -> 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 Source # | |
Eq a => Eq (HieType a) Source # | |
Binary (HieType TypeIndex) Source # | |
type HieTypeFlat = HieType TypeIndex Source #
A list of type arguments along with their respective visibilities (ie. is
this an argument that would return True
for isVisibleArgFlag
?).
Instances
Functor HieArgs Source # | |
Foldable HieArgs Source # | |
Defined in HieTypes fold :: Monoid m => HieArgs m -> 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 Source # | |
Eq a => Eq (HieArgs a) Source # | |
Binary (HieArgs TypeIndex) Source # | |
Mapping from filepaths (represented using FastString
) to the
corresponding AST
HieASTs | |
|
Instances
Functor HieASTs Source # | |
Foldable HieASTs Source # | |
Defined in HieTypes fold :: Monoid m => HieASTs m -> 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 Source # | |
Binary (HieASTs TypeIndex) Source # | |
Instances
Functor HieAST Source # | |
Foldable HieAST Source # | |
Defined in HieTypes fold :: Monoid m => HieAST m -> 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 Source # | |
Binary (HieAST TypeIndex) Source # | |
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
Functor NodeInfo Source # | |
Foldable NodeInfo Source # | |
Defined in HieTypes fold :: Monoid m => NodeInfo m -> 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 Source # | |
Binary (NodeInfo TypeIndex) Source # | |
type Identifier = Either ModuleName Name Source #
type NodeIdentifiers a = Map Identifier (IdentifierDetails a) Source #
data IdentifierDetails a Source #
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 ContextInfo Source #
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 |
Instances
Eq ContextInfo Source # | |
Defined in HieTypes (==) :: ContextInfo -> ContextInfo -> Bool # (/=) :: ContextInfo -> ContextInfo -> Bool # | |
Ord ContextInfo Source # | |
Defined in HieTypes compare :: ContextInfo -> ContextInfo -> Ordering # (<) :: ContextInfo -> ContextInfo -> Bool # (<=) :: ContextInfo -> ContextInfo -> Bool # (>) :: ContextInfo -> ContextInfo -> Bool # (>=) :: ContextInfo -> ContextInfo -> Bool # max :: ContextInfo -> ContextInfo -> ContextInfo # min :: ContextInfo -> ContextInfo -> ContextInfo # | |
Show ContextInfo Source # | |
Defined in HieTypes showsPrec :: Int -> ContextInfo -> ShowS # show :: ContextInfo -> String # showList :: [ContextInfo] -> ShowS # | |
Binary ContextInfo Source # | |
Defined in HieTypes put_ :: BinHandle -> ContextInfo -> IO () # put :: BinHandle -> ContextInfo -> IO (Bin ContextInfo) # get :: BinHandle -> IO ContextInfo # | |
Outputable ContextInfo Source # | |
Defined in HieTypes ppr :: ContextInfo -> SDoc # pprPrec :: Rational -> ContextInfo -> SDoc # |
Types of imports and exports
data RecFieldContext Source #
Instances
Instances
Enum BindType Source # | |
Eq BindType Source # | |
Ord BindType Source # | |
Show BindType Source # | |
Binary BindType Source # | |
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 Source # | |
Eq DeclType Source # | |
Ord DeclType Source # | |
Show DeclType Source # | |
Binary DeclType Source # | |
Instances
Eq Scope Source # | |
Data Scope Source # | |
Defined in HieTypes 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 :: (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 # | |
Ord Scope Source # | |
Show Scope Source # | |
Binary Scope Source # | |
Outputable Scope Source # | |
data TyVarScope Source #
Scope of a type variable.
This warrants a data type apart from Scope
because of complexities
introduced by features like -XScopedTypeVariables
and -XInstanceSigs
. For
example, consider:
foo, bar, baz :: forall a. a -> a
Here a
is in scope in all the definitions of foo
, bar
, and baz
, so we
need a list of scopes to keep track of this. Furthermore, this list cannot be
computed until we resolve the binding sites of foo
, bar
, and baz
.
Consequently, a
starts with an
which later gets resolved into a UnresolvedScope
[foo, bar, baz] NothingResolvedScopes
.
ResolvedScopes [Scope] | |
UnresolvedScope | Unresolved scopes should never show up in the final |
Instances
Eq TyVarScope Source # | |
Defined in HieTypes (==) :: TyVarScope -> TyVarScope -> Bool # (/=) :: TyVarScope -> TyVarScope -> Bool # | |
Ord TyVarScope Source # | |
Defined in HieTypes compare :: TyVarScope -> TyVarScope -> Ordering # (<) :: TyVarScope -> TyVarScope -> Bool # (<=) :: TyVarScope -> TyVarScope -> Bool # (>) :: TyVarScope -> TyVarScope -> Bool # (>=) :: TyVarScope -> TyVarScope -> Bool # max :: TyVarScope -> TyVarScope -> TyVarScope # min :: TyVarScope -> TyVarScope -> TyVarScope # | |
Show TyVarScope Source # | |
Defined in HieTypes showsPrec :: Int -> TyVarScope -> ShowS # show :: TyVarScope -> String # showList :: [TyVarScope] -> ShowS # | |
Binary TyVarScope Source # | |
Defined in HieTypes put_ :: BinHandle -> TyVarScope -> IO () # put :: BinHandle -> TyVarScope -> IO (Bin TyVarScope) # get :: BinHandle -> IO TyVarScope # |