chr-data-0.1.0.0: Datatypes required for chr library

Safe HaskellNone
LanguageHaskell2010

CHR.Data.Lookup.Stacked

Description

Lookups combined into stack of lookups, allowing combined lookup coupled with updates on top of stack only

Synopsis

Documentation

class Stacked stk where Source #

Functionality on top of Lookup for awareness of a scope. Minimal definition lifts, 'unlifts,', 'top'/'topM', 'pop'/'popM', 'push'/'pushM'

Minimal complete definition

lifts, unlifts

Methods

lifts :: StackedElt stk -> stk Source #

unlifts :: stk -> [StackedElt stk] Source #

top :: stk -> StackedElt stk Source #

pop :: stk -> (StackedElt stk, stk) Source #

push :: StackedElt stk -> stk -> stk Source #

topM :: MonadState stk m => m (StackedElt stk) Source #

popM :: MonadState stk m => m (StackedElt stk) Source #

pushM :: MonadState stk m => StackedElt stk -> m () Source #

tops :: stk -> stk Source #

pops :: stk -> (stk, stk) Source #

pushs Source #

Arguments

:: stk 
-> stk 
-> stk

push, but only top of first arg

topsM :: MonadState stk m => m stk Source #

popsM :: MonadState stk m => m stk Source #

pushsM :: MonadState stk m => stk -> m () Source #

Instances

Stacked (Stacks lkup) Source # 

Methods

lifts :: StackedElt (Stacks lkup) -> Stacks lkup Source #

unlifts :: Stacks lkup -> [StackedElt (Stacks lkup)] Source #

top :: Stacks lkup -> StackedElt (Stacks lkup) Source #

pop :: Stacks lkup -> (StackedElt (Stacks lkup), Stacks lkup) Source #

push :: StackedElt (Stacks lkup) -> Stacks lkup -> Stacks lkup Source #

topM :: MonadState (Stacks lkup) m => m (StackedElt (Stacks lkup)) Source #

popM :: MonadState (Stacks lkup) m => m (StackedElt (Stacks lkup)) Source #

pushM :: MonadState (Stacks lkup) m => StackedElt (Stacks lkup) -> m () Source #

tops :: Stacks lkup -> Stacks lkup Source #

pops :: Stacks lkup -> (Stacks lkup, Stacks lkup) Source #

pushs :: Stacks lkup -> Stacks lkup -> Stacks lkup Source #

topsM :: MonadState (Stacks lkup) m => m (Stacks lkup) Source #

popsM :: MonadState (Stacks lkup) m => m (Stacks lkup) Source #

pushsM :: MonadState (Stacks lkup) m => Stacks lkup -> m () Source #

type family StackedElt stk :: * Source #

Instances

newtype Stacks l Source #

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

Constructors

Stacks 

Fields

Instances

Functor Stacks Source # 

Methods

fmap :: (a -> b) -> Stacks a -> Stacks b #

(<$) :: a -> Stacks b -> Stacks a #

Applicative Stacks Source # 

Methods

pure :: a -> Stacks a #

(<*>) :: Stacks (a -> b) -> Stacks a -> Stacks b #

liftA2 :: (a -> b -> c) -> Stacks a -> Stacks b -> Stacks c #

(*>) :: Stacks a -> Stacks b -> Stacks b #

(<*) :: Stacks a -> Stacks b -> Stacks a #

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

Methods

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

Show (Stacks s) Source # 

Methods

showsPrec :: Int -> Stacks s -> ShowS #

show :: Stacks s -> String #

showList :: [Stacks s] -> ShowS #

PP s => PP (Stacks s) Source # 

Methods

pp :: Stacks s -> PP_Doc #

ppList :: [Stacks s] -> PP_Doc #

Stacked (Stacks lkup) Source # 

Methods

lifts :: StackedElt (Stacks lkup) -> Stacks lkup Source #

unlifts :: Stacks lkup -> [StackedElt (Stacks lkup)] Source #

top :: Stacks lkup -> StackedElt (Stacks lkup) Source #

pop :: Stacks lkup -> (StackedElt (Stacks lkup), Stacks lkup) Source #

push :: StackedElt (Stacks lkup) -> Stacks lkup -> Stacks lkup Source #

topM :: MonadState (Stacks lkup) m => m (StackedElt (Stacks lkup)) Source #

popM :: MonadState (Stacks lkup) m => m (StackedElt (Stacks lkup)) Source #

pushM :: MonadState (Stacks lkup) m => StackedElt (Stacks lkup) -> m () Source #

tops :: Stacks lkup -> Stacks lkup Source #

pops :: Stacks lkup -> (Stacks lkup, Stacks lkup) Source #

pushs :: Stacks lkup -> Stacks lkup -> Stacks lkup Source #

topsM :: MonadState (Stacks lkup) m => m (Stacks lkup) Source #

popsM :: MonadState (Stacks lkup) m => m (Stacks lkup) Source #

pushsM :: MonadState (Stacks lkup) m => Stacks lkup -> m () Source #

Lookup lkup k v => Lookup (Stacks lkup) k v Source # 

Methods

lookup :: k -> Stacks lkup -> Maybe v Source #

fromList :: [(k, v)] -> Stacks lkup Source #

toList :: Stacks lkup -> [(k, v)] Source #

null :: Stacks lkup -> Bool Source #

size :: Stacks lkup -> Int Source #

alter :: (Maybe v -> Maybe v) -> k -> Stacks lkup -> Stacks lkup Source #

singleton :: k -> v -> Stacks lkup Source #

empty :: Stacks lkup Source #

insertWith :: (v -> v -> v) -> k -> v -> Stacks lkup -> Stacks lkup Source #

insert :: k -> v -> Stacks lkup -> Stacks lkup Source #

unionWith :: (v -> v -> v) -> Stacks lkup -> Stacks lkup -> Stacks lkup Source #

union :: Stacks lkup -> Stacks lkup -> Stacks lkup Source #

unionsWith :: (v -> v -> v) -> [Stacks lkup] -> Stacks lkup Source #

unions :: [Stacks lkup] -> Stacks lkup Source #

delete :: k -> Stacks lkup -> Stacks lkup Source #

keys :: Stacks lkup -> [k] Source #

keysSet :: Stacks lkup -> Set k Source #

elems :: Stacks lkup -> [v] Source #

map :: (v -> v) -> Stacks lkup -> Stacks lkup Source #

type StackedElt (Stacks e) Source # 
type StackedElt (Stacks e) = e
type StackedElt (StackedVarLookup s) Source # 
type VarLookupVal (StackedVarLookup s) Source # 
type VarLookupKey (StackedVarLookup s) Source #