chr-data-0.1.0.0: Datatypes required for chr library

Safe HaskellNone
LanguageHaskell2010

CHR.Data.VarLookup

Description

Abstractions for looking up (type) variables in structures

Synopsis

Documentation

type family VarLookupKey m :: * Source #

Type family for key of a VarLookup

type family VarLookupVal m :: * Source #

Type family for value of a VarLookup

class VarLookup m where Source #

VarLookup abstracts from a Map. The purpose is to be able to combine maps only for the purpose of searching without actually merging the maps. This then avoids the later need to unmerge such mergings. The class interface serves to hide this.

Methods

varlookupWithMetaLev :: MetaLev -> VarLookupKey m -> m -> Maybe (VarLookupVal m) Source #

Lookup a key at a level

varlookup :: VarLookupKey m -> m -> Maybe (VarLookupVal m) Source #

Lookup a key

varlookupKeysSetWithMetaLev :: Ord (VarLookupKey m) => MetaLev -> m -> Set (VarLookupKey m) Source #

Keys at a level

varlookupKeysSet :: Ord (VarLookupKey m) => m -> Set (VarLookupKey m) Source #

Keys as Set

varlookupEmpty :: m Source #

Make an empty VarLookup

varlookupSingletonWithMetaLev :: MetaLev -> VarLookupKey m -> VarLookupVal m -> m Source #

Make a singleton VarLookup at a level

varlookupSingleton :: VarLookupKey m -> VarLookupVal m -> m Source #

Make a singleton VarLookup

class LookupApply l1 l2 where Source #

Minimal complete definition

apply

Methods

apply :: l1 -> l2 -> l2 Source #

Instances

LookupApply l1 l2 => LookupApply l1 (Stacks l2) Source # 

Methods

apply :: l1 -> Stacks l2 -> Stacks l2 Source #

Ord k => LookupApply (VarMp' k v) (VarMp' k v) Source # 

Methods

apply :: VarMp' k v -> VarMp' k v -> VarMp' k v Source #

type MetaLev = Int Source #

Level to lookup into

metaLevVal :: MetaLev Source #

Base level (of values, usually)

type StackedVarLookup s = Stacks s Source #

VarLookupCmb abstracts the combining of/from a substitution. The interface goes along with VarLookup but is split off to avoid functional dependency restrictions. The purpose is to be able to combine maps only for the purpose of searching without actually merging the maps. This then avoids the later need to unmerge such mergings.

Stacked VarLookup derived from a base one, to allow a use of multiple lookups but update on top only