type-level-sets-0.6.1: Type-level sets and finite maps (with value-level counterparts)

Data.Type.Map

Synopsis

Documentation

data Mapping k v Source #

A key-value pair

Constructors

 k :-> v infixr 4

Instances

 (KnownSymbol k, Show v, Show' (Map s)) => Show (Map ((:) (Mapping Symbol *) ((:->) Symbol * k v) s)) Source # MethodsshowsPrec :: Int -> Map ((Mapping Symbol * ': (Symbol :-> *) k v) s) -> ShowS #show :: Map ((Mapping Symbol * ': (Symbol :-> *) k v) s) -> String #showList :: [Map ((Mapping Symbol * ': (Symbol :-> *) k v) s)] -> ShowS # Show (Map ([] (Mapping Symbol *))) Source # MethodsshowsPrec :: Int -> Map [Mapping Symbol *] -> ShowS #show :: Map [Mapping Symbol *] -> String #showList :: [Map [Mapping Symbol *]] -> ShowS # type Cmp (Mapping Symbol v) ((:->) Symbol v k v1) ((:->) Symbol v k' v1) Source # type Cmp (Mapping Symbol v) ((:->) Symbol v k v1) ((:->) Symbol v k' v1) = CmpSymbol k k'

type Union m n = Nub (Sort (m :++ n)) Source #

Union of two finite maps

type Unionable s t = (Nubable (Sort (s :++ t)), Sortable (s :++ t)) Source #

union :: Unionable s t => Map s -> Map t -> Map (Union s t) Source #

Union of two finite maps

data Var k Source #

Pair a symbol (representing a variable) with a type

Constructors

 Var

Instances

 KnownSymbol k => Show (Var k) Source # MethodsshowsPrec :: Int -> Var k -> ShowS #show :: Var k -> String #showList :: [Var k] -> ShowS #

data Map n where Source #

A value-level heterogenously-typed Map (with type-level representation in terms of lists)

Constructors

 Empty :: Map '[] Ext :: Var k -> v -> Map m -> Map ((k :-> v) ': m)

Instances

 (KnownSymbol k, Show v, Show' (Map s)) => Show (Map ((:) (Mapping Symbol *) ((:->) Symbol * k v) s)) Source # MethodsshowsPrec :: Int -> Map ((Mapping Symbol * ': (Symbol :-> *) k v) s) -> ShowS #show :: Map ((Mapping Symbol * ': (Symbol :-> *) k v) s) -> String #showList :: [Map ((Mapping Symbol * ': (Symbol :-> *) k v) s)] -> ShowS # Show (Map ([] (Mapping Symbol *))) Source # MethodsshowsPrec :: Int -> Map [Mapping Symbol *] -> ShowS #show :: Map [Mapping Symbol *] -> String #showList :: [Map [Mapping Symbol *]] -> ShowS #

type family Combine (a :: v) (b :: v) :: v Source #

Open type family for combining values in a map (that have the same key)

class Combinable t t' where Source #

Minimal complete definition

combine

Methods

combine :: t -> t' -> Combine t t' Source #

type family Cmp (a :: k) (b :: k) :: Ordering Source #

Open-family for the ordering operation in the sort

Instances

 type Cmp Symbol k k' Source # type Cmp Symbol k k' = CmpSymbol k k' type Cmp (Mapping Symbol v) ((:->) Symbol v k v1) ((:->) Symbol v k' v1) Source # type Cmp (Mapping Symbol v) ((:->) Symbol v k v1) ((:->) Symbol v k' v1) = CmpSymbol k k'

type family Lookup (m :: [Mapping k v]) (c :: k) :: Maybe v where ... Source #

Lookup elements from a map

Equations

 Lookup '[] k = Nothing Lookup ((k :-> v) ': m) k = Just v Lookup (kvp ': m) k = Lookup m k

type family Member (c :: k) (m :: [Mapping k v]) :: Bool where ... Source #

Membership test

Equations

 Member k '[] = False Member k ((k :-> v) ': m) = True Member k (kvp ': m) = Member k m

type family (m :: [Mapping k v]) :\ (c :: k) :: [Mapping k v] where ... Source #

Delete elements from a map by key

Equations

 '[] :\ k = '[] ((k :-> v) ': m) :\ k = m :\ k (kvp ': m) :\ k = kvp ': (m :\ k)