HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduledhall-1.42.3Haskell2010

Dhall.Context

This is a utility module that consolidates all Context-related operations

  • 1 type
  • 5 values
  • Packagedhall-1.42.3
  • Exports6
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceContext.hs

Context

6 declarations
newtypenewtype Context a
#

A (Context a) associates Text labels with values of type a. Each Text label can correspond to multiple values of type a

The Context is used for type-checking when (a = Expr X)

The difference between a Context and a Data.Map.Map is that a Context lets you have multiple ordered occurrences of the same key and you can query for the nth occurrence of a given key.

Instances1Functor
valueempty :: Context a
#

An empty context with no key-value pairs

valuelookup :: Text -> Int -> Context a -> Maybe a
#

Look up a key by name and index

lookup _ _         empty  = Nothing
lookup k 0 (insert k v c) = Just v
lookup k n (insert k v c) = lookup k (n - 1) c
lookup k n (insert j v c) = lookup k  n      c  -- k /= j
valuetoList :: Context a -> [(Text, a)]
#

Return all key-value associations as a list

toList           empty  = []
toList (insert k v ctx) = (k, v) : toList ctx