morte-1.6.12: A bare-bones calculus of constructions
Morte.Context
Contents
Description
All Context-related operations
Context
Synopsis
data Context a Source #
Bound variable names and their types
Variable names may appear more than once in the Context. The Var x@n refers to the nth occurrence of x in the Context (using 0-based numbering).
Var
x@n
n
x
Instances
Methods
fmap :: (a -> b) -> Context a -> Context b #
(<$) :: a -> Context b -> Context a #
rnf :: Context a -> () #
empty :: Context a Source #
An empty context with no key-value pairs
toList empty = []
insert :: Text -> a -> Context a -> Context a Source #
Add a key-value pair to the Context
lookup :: Text -> Int -> Context a -> Maybe a Source #
Lookup a key by name and index
lookup k 0 (insert k v0 ctx ) = Just v0 lookup k 1 (insert k v0 (insert k v1 ctx)) = Just v1
toList :: Context a -> [(Text, a)] Source #
Return all key-value associations as a list