HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleghc-9.10.3GHC2021

GHC.Core.RoughMap

RoughMap is an approximate finite map data structure keyed on [RoughMatchTc]. This is useful when keying maps on lists of Types (e.g. an instance head).

  • 3 types
  • 17 values
  • Packageghc-9.10.3
  • Exports20
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceRoughMap.hs

RoughMatchTc

9 declarations

RoughMap

11 declarations
datadata RoughMap a
#

Trie of [RoughMatchTc]

  • Examples* insert [OtherTc] 1 insert [OtherTc] 2 lookup [OtherTc] == [1,2]

Instances2Functor, Outputable
valuelookupRM' :: [RoughMatchLookupTc] -> RoughMap a -> (Bag a, [a])
#

N.B. Returns a Bag for matches, which allows us to avoid rebuilding all of the lists we find in rm_empty, which would otherwise be necessary due to ++ if we returned a list. We use a list for unifiers because the tail is computed lazily and we often only care about the first couple of potential unifiers. Constructing a bag forces the tail which performs much too much work.

See Note [Matching a RoughMap] See Note [Matches vs Unifiers]