uhc-util-0.1.6.6: UHC utilities

Safe HaskellNone
LanguageHaskell98

UHC.Util.VarLookup

Description

Abstractions for looking up (type) variables in structures

Synopsis

Documentation

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

type family VarLookupKey m :: * Source

Type family for key of a VarLookup

Instances

type family VarLookupVal m :: * Source

Type family for value of a VarLookup

Instances

varlookupResolveVar :: VarLookup m => (VarLookupVal m -> Maybe (VarLookupKey m)) -> VarLookupKey m -> m -> Maybe (VarLookupVal m) Source

Fully resolve lookup

varlookupResolveVal :: VarLookup m => (VarLookupVal m -> Maybe (VarLookupKey m)) -> VarLookupVal m -> m -> Maybe (VarLookupVal m) Source

Fully resolve lookup

varlookupMap :: VarLookup m => (VarLookupVal m -> Maybe res) -> VarLookupKey m -> m -> Maybe res Source

Combine lookup with map; should be obsolete...

varlookupResolveAndContinueM :: (Monad m, VarLookup s) => (VarLookupVal s -> Maybe (VarLookupKey s)) -> m s -> m a -> (VarLookupVal s -> m a) -> VarLookupKey s -> m a Source

Monadically lookup a variable, resolve it, continue with either a fail or success monad continuation

type VarLookupFix k v = k -> Maybe v Source

varlookupFix :: VarLookup m => m -> VarLookupFix (VarLookupKey m) (VarLookupVal m) Source

fix looking up to be for a certain var mapping

varlookupFixDel :: Ord k => [k] -> VarLookupFix k v -> VarLookupFix k v Source

simulate deletion

class VarLookupCmb m1 m2 where 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.

Methods

(|+>) :: m1 -> m2 -> m2 infixr 7 Source

Instances

type VarLookupCmbFix m1 m2 = m1 -> m2 -> m2 Source

Deprecated: As of 20160331: don't use these anymore

varlookupcmbFix :: VarLookupCmb m1 m2 => VarLookupCmbFix m1 m2 Source

Deprecated: As of 20160331: don't use these anymore

fix combining up to be for a certain var mapping

type MetaLev = Int Source

Level to lookup into

metaLevVal :: MetaLev Source

Base level (of values, usually)

newtype StackedVarLookup s Source

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

Constructors

StackedVarLookup 

Fields

unStackedVarLookup :: [s]