HORIZON HASKELLDocslts/ghc-9.14.x3e2d5682026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 3e2d568 · 2026-10-11

Moduleghc-9.14.1GHC2021

GHC.Core.Map.Type

  • 9 types
  • 1 class
  • 22 values
  • Packageghc-9.14.1
  • Exports32
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceType.hs

Re-export generic interface

2 declarations
classclass Functor m => TrieMap (m :: Type -> Type) where
#

Associated types

Methods

Instances20TrieMap, …

Maps over Types

6 declarations
newtypenewtype TypeMap a
#

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.

Instances3Functor, TrieMap, Key

With explicit scoping

valueextendTypeMapWithScope :: TypeMap a -> CmEnv -> Type -> a -> TypeMap a
#

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.

valuemkDeBruijnContext :: [Var] -> CmEnv
#

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

16 declarations
typetype TypeMapG = GenMap TypeMapX
#

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.

datadata DeBruijn a
#

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

Instances7Eq, …
valuedeBruijnize :: a -> DeBruijn a
#

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.

datadata BndrMap a
#

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.

Instances3Functor, TrieMap, Key
datadata VarMap a
#
Instances3Functor, TrieMap, Key