ghc-9.4.2: The GHC API
Safe HaskellSafe-Inferred
LanguageHaskell2010

GHC.Core.Map.Type

Synopsis

Re-export generic interface

class TrieMap m where Source #

Associated Types

type Key m :: Type Source #

Methods

emptyTM :: m a Source #

lookupTM :: forall b. Key m -> m b -> Maybe b Source #

alterTM :: forall b. Key m -> XT b -> m b -> m b Source #

mapTM :: (a -> b) -> m a -> m b Source #

filterTM :: (a -> Bool) -> m a -> m a Source #

foldTM :: (a -> b -> b) -> m a -> b -> b Source #

Instances

Instances details
TrieMap IntMap Source # 
Instance details

Defined in GHC.Data.TrieMap

Associated Types

type Key IntMap Source #

Methods

emptyTM :: IntMap a Source #

lookupTM :: Key IntMap -> IntMap b -> Maybe b Source #

alterTM :: Key IntMap -> XT b -> IntMap b -> IntMap b Source #

mapTM :: (a -> b) -> IntMap a -> IntMap b Source #

filterTM :: (a -> Bool) -> IntMap a -> IntMap a Source #

foldTM :: (a -> b -> b) -> IntMap a -> b -> b Source #

TrieMap LabelMap Source # 
Instance details

Defined in GHC.Cmm.Dataflow.Label

Associated Types

type Key LabelMap Source #

Methods

emptyTM :: LabelMap a Source #

lookupTM :: Key LabelMap -> LabelMap b -> Maybe b Source #

alterTM :: Key LabelMap -> XT b -> LabelMap b -> LabelMap b Source #

mapTM :: (a -> b) -> LabelMap a -> LabelMap b Source #

filterTM :: (a -> Bool) -> LabelMap a -> LabelMap a Source #

foldTM :: (a -> b -> b) -> LabelMap a -> b -> b Source #

TrieMap CoreMap Source # 
Instance details

Defined in GHC.Core.Map.Expr

Associated Types

type Key CoreMap Source #

Methods

emptyTM :: CoreMap a Source #

lookupTM :: Key CoreMap -> CoreMap b -> Maybe b Source #

alterTM :: Key CoreMap -> XT b -> CoreMap b -> CoreMap b Source #

mapTM :: (a -> b) -> CoreMap a -> CoreMap b Source #

filterTM :: (a -> Bool) -> CoreMap a -> CoreMap a Source #

foldTM :: (a -> b -> b) -> CoreMap a -> b -> b Source #

TrieMap BndrMap Source # 
Instance details

Defined in GHC.Core.Map.Type

Associated Types

type Key BndrMap Source #

Methods

emptyTM :: BndrMap a Source #

lookupTM :: Key BndrMap -> BndrMap b -> Maybe b Source #

alterTM :: Key BndrMap -> XT b -> BndrMap b -> BndrMap b Source #

mapTM :: (a -> b) -> BndrMap a -> BndrMap b Source #

filterTM :: (a -> Bool) -> BndrMap a -> BndrMap a Source #

foldTM :: (a -> b -> b) -> BndrMap a -> b -> b Source #

TrieMap LooseTypeMap Source # 
Instance details

Defined in GHC.Core.Map.Type

Associated Types

type Key LooseTypeMap Source #

TrieMap TypeMap Source # 
Instance details

Defined in GHC.Core.Map.Type

Associated Types

type Key TypeMap Source #

Methods

emptyTM :: TypeMap a Source #

lookupTM :: Key TypeMap -> TypeMap b -> Maybe b Source #

alterTM :: Key TypeMap -> XT b -> TypeMap b -> TypeMap b Source #

mapTM :: (a -> b) -> TypeMap a -> TypeMap b Source #

filterTM :: (a -> Bool) -> TypeMap a -> TypeMap a Source #

foldTM :: (a -> b -> b) -> TypeMap a -> b -> b Source #

TrieMap VarMap Source # 
Instance details

Defined in GHC.Core.Map.Type

Associated Types

type Key VarMap Source #

Methods

emptyTM :: VarMap a Source #

lookupTM :: Key VarMap -> VarMap b -> Maybe b Source #

alterTM :: Key VarMap -> XT b -> VarMap b -> VarMap b Source #

mapTM :: (a -> b) -> VarMap a -> VarMap b Source #

filterTM :: (a -> Bool) -> VarMap a -> VarMap a Source #

foldTM :: (a -> b -> b) -> VarMap a -> b -> b Source #

Ord k => TrieMap (Map k) Source # 
Instance details

Defined in GHC.Data.TrieMap

Associated Types

type Key (Map k) Source #

Methods

emptyTM :: Map k a Source #

lookupTM :: Key (Map k) -> Map k b -> Maybe b Source #

alterTM :: Key (Map k) -> XT b -> Map k b -> Map k b Source #

mapTM :: (a -> b) -> Map k a -> Map k b Source #

filterTM :: (a -> Bool) -> Map k a -> Map k a Source #

foldTM :: (a -> b -> b) -> Map k a -> b -> b Source #

(Eq (Key m), TrieMap m) => TrieMap (GenMap m) Source # 
Instance details

Defined in GHC.Data.TrieMap

Associated Types

type Key (GenMap m) Source #

Methods

emptyTM :: GenMap m a Source #

lookupTM :: Key (GenMap m) -> GenMap m b -> Maybe b Source #

alterTM :: Key (GenMap m) -> XT b -> GenMap m b -> GenMap m b Source #

mapTM :: (a -> b) -> GenMap m a -> GenMap m b Source #

filterTM :: (a -> Bool) -> GenMap m a -> GenMap m a Source #

foldTM :: (a -> b -> b) -> GenMap m a -> b -> b Source #

TrieMap m => TrieMap (ListMap m) Source # 
Instance details

Defined in GHC.Data.TrieMap

Associated Types

type Key (ListMap m) Source #

Methods

emptyTM :: ListMap m a Source #

lookupTM :: Key (ListMap m) -> ListMap m b -> Maybe b Source #

alterTM :: Key (ListMap m) -> XT b -> ListMap m b -> ListMap m b Source #

mapTM :: (a -> b) -> ListMap m a -> ListMap m b Source #

filterTM :: (a -> Bool) -> ListMap m a -> ListMap m a Source #

foldTM :: (a -> b -> b) -> ListMap m a -> b -> b Source #

TrieMap m => TrieMap (MaybeMap m) Source # 
Instance details

Defined in GHC.Data.TrieMap

Associated Types

type Key (MaybeMap m) Source #

Methods

emptyTM :: MaybeMap m a Source #

lookupTM :: Key (MaybeMap m) -> MaybeMap m b -> Maybe b Source #

alterTM :: Key (MaybeMap m) -> XT b -> MaybeMap m b -> MaybeMap m b Source #

mapTM :: (a -> b) -> MaybeMap m a -> MaybeMap m b Source #

filterTM :: (a -> Bool) -> MaybeMap m a -> MaybeMap m a Source #

foldTM :: (a -> b -> b) -> MaybeMap m a -> b -> b Source #

Uniquable key => TrieMap (UniqDFM key) Source # 
Instance details

Defined in GHC.Data.TrieMap

Associated Types

type Key (UniqDFM key) Source #

Methods

emptyTM :: UniqDFM key a Source #

lookupTM :: Key (UniqDFM key) -> UniqDFM key b -> Maybe b Source #

alterTM :: Key (UniqDFM key) -> XT b -> UniqDFM key b -> UniqDFM key b Source #

mapTM :: (a -> b) -> UniqDFM key a -> UniqDFM key b Source #

filterTM :: (a -> Bool) -> UniqDFM key a -> UniqDFM key a Source #

foldTM :: (a -> b -> b) -> UniqDFM key a -> b -> b Source #

type XT a = Maybe a -> Maybe a Source #

Maps over Types

data TypeMap a Source #

TypeMap a is a map from Type to a. If you are a client, this is the type you want. The keys in this map may have different kinds.

Instances

Instances details
TrieMap TypeMap Source # 
Instance details

Defined in GHC.Core.Map.Type

Associated Types

type Key TypeMap Source #

Methods

emptyTM :: TypeMap a Source #

lookupTM :: Key TypeMap -> TypeMap b -> Maybe b Source #

alterTM :: Key TypeMap -> XT b -> TypeMap b -> TypeMap b Source #

mapTM :: (a -> b) -> TypeMap a -> TypeMap b Source #

filterTM :: (a -> Bool) -> TypeMap a -> TypeMap a Source #

foldTM :: (a -> b -> b) -> TypeMap a -> b -> b Source #

type Key TypeMap Source # 
Instance details

Defined in GHC.Core.Map.Type

foldTypeMap :: (a -> b -> b) -> b -> TypeMap a -> b Source #

data LooseTypeMap a Source #

A LooseTypeMap doesn't do a kind-check. Thus, when lookup up (t |> g), you'll find entries inserted under (t), even if (g) is non-reflexive.

Instances

Instances details
TrieMap LooseTypeMap Source # 
Instance details

Defined in GHC.Core.Map.Type

Associated Types

type Key LooseTypeMap Source #

type Key LooseTypeMap Source # 
Instance details

Defined in GHC.Core.Map.Type

With explicit scoping

lookupCME :: CmEnv -> Var -> Maybe BoundVar Source #

extendTypeMapWithScope :: TypeMap a -> CmEnv -> Type -> a -> TypeMap a Source #

Extend a TypeMap with a type in the given context. extendTypeMapWithScope m (mkDeBruijnContext [a,b,c]) t v is equivalent to extendTypeMap m (forall a b c. t) v, but allows reuse of the context over multiple insertions.

mkDeBruijnContext :: [Var] -> CmEnv Source #

Construct a deBruijn environment with the given variables in scope. e.g. mkDeBruijnEnv [a,b,c] constructs a context forall a b c.

Utilities for use by friends only

type TypeMapG = GenMap TypeMapX Source #

TypeMapG a is a map from DeBruijn Type to a. The extended key makes it suitable for recursive traversal, since it can track binders, but it is strictly internal to this module. If you are including a TypeMap inside another TrieMap, this is the type you want. Note that this lookup does not do a kind-check. Thus, all keys in this map must have the same kind. Also note that this map respects the distinction between Type and Constraint, despite the fact that they are equivalent type synonyms in Core.

type CoercionMapG = GenMap CoercionMapX Source #

data DeBruijn a Source #

DeBruijn a represents a modulo alpha-renaming. This is achieved by equipping the value with a CmEnv, which tracks an on-the-fly deBruijn numbering. This allows us to define an Eq instance for DeBruijn a, even if this was not (easily) possible for a. Note: we purposely don't export the constructor. Make a helper function if you find yourself needing it.

Constructors

D CmEnv a 

Instances

Instances details
Eq (DeBruijn CoreAlt) Source # 
Instance details

Defined in GHC.Core.Map.Expr

Eq (DeBruijn CoreExpr) Source # 
Instance details

Defined in GHC.Core.Map.Expr

Eq (DeBruijn Coercion) Source # 
Instance details

Defined in GHC.Core.Map.Type

Eq (DeBruijn Type) Source # 
Instance details

Defined in GHC.Core.Map.Type

Eq (DeBruijn Var) Source # 
Instance details

Defined in GHC.Core.Map.Type

Eq (DeBruijn a) => Eq (DeBruijn (Maybe a)) Source # 
Instance details

Defined in GHC.Core.Map.Type

Methods

(==) :: DeBruijn (Maybe a) -> DeBruijn (Maybe a) -> Bool #

(/=) :: DeBruijn (Maybe a) -> DeBruijn (Maybe a) -> Bool #

Eq (DeBruijn a) => Eq (DeBruijn [a]) Source # 
Instance details

Defined in GHC.Core.Map.Type

Methods

(==) :: DeBruijn [a] -> DeBruijn [a] -> Bool #

(/=) :: DeBruijn [a] -> DeBruijn [a] -> Bool #

deBruijnize :: a -> DeBruijn a Source #

Synthesizes a DeBruijn a from an a, by assuming that there are no bound binders (an empty CmEnv). This is usually what you want if there isn't already a CmEnv in scope.

data BndrMap a Source #

A BndrMap is a TypeMapG which allows us to distinguish between binding forms whose binders have different types. For example, if we are doing a TrieMap lookup on (x :: Int) -> (), we should not pick up an entry in the TrieMap for (x :: Bool) -> (): we can disambiguate this by matching on the type (or kind, if this a binder in a type) of the binder.

We also need to do the same for multiplicity! Which, since multiplicities are encoded simply as a Type, amounts to have a Trie for a pair of types. Tries of pairs are composition.

Instances

Instances details
TrieMap BndrMap Source # 
Instance details

Defined in GHC.Core.Map.Type

Associated Types

type Key BndrMap Source #

Methods

emptyTM :: BndrMap a Source #

lookupTM :: Key BndrMap -> BndrMap b -> Maybe b Source #

alterTM :: Key BndrMap -> XT b -> BndrMap b -> BndrMap b Source #

mapTM :: (a -> b) -> BndrMap a -> BndrMap b Source #

filterTM :: (a -> Bool) -> BndrMap a -> BndrMap a Source #

foldTM :: (a -> b -> b) -> BndrMap a -> b -> b Source #

type Key BndrMap Source # 
Instance details

Defined in GHC.Core.Map.Type

type Key BndrMap = Var

xtBndr :: forall a. CmEnv -> Var -> XT a -> BndrMap a -> BndrMap a Source #

lkBndr :: CmEnv -> Var -> BndrMap a -> Maybe a Source #

data VarMap a Source #

Instances

Instances details
TrieMap VarMap Source # 
Instance details

Defined in GHC.Core.Map.Type

Associated Types

type Key VarMap Source #

Methods

emptyTM :: VarMap a Source #

lookupTM :: Key VarMap -> VarMap b -> Maybe b Source #

alterTM :: Key VarMap -> XT b -> VarMap b -> VarMap b Source #

mapTM :: (a -> b) -> VarMap a -> VarMap b Source #

filterTM :: (a -> Bool) -> VarMap a -> VarMap a Source #

foldTM :: (a -> b -> b) -> VarMap a -> b -> b Source #

type Key VarMap Source # 
Instance details

Defined in GHC.Core.Map.Type

type Key VarMap = Var

xtVar :: CmEnv -> Var -> XT a -> VarMap a -> VarMap a Source #

lkVar :: CmEnv -> Var -> VarMap a -> Maybe a Source #

xtDFreeVar :: Var -> XT a -> DVarEnv a -> DVarEnv a Source #

xtDNamed :: NamedThing n => n -> XT a -> DNameEnv a -> DNameEnv a Source #