Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Synopsis
- data Mapping k v = k :-> v
- type Union m n = Nub (Sort (m :++ n))
- type Unionable s t = (Nubable (Sort (s :++ t)), Sortable (s :++ t))
- union :: Unionable s t => Map s -> Map t -> Map (Union s t)
- data Var (k :: Symbol) = Var
- data Map (n :: [Mapping Symbol *]) where
- type family Combine (a :: v) (b :: v) :: v
- class Combinable t t' where
- type family Cmp (a :: k) (b :: k) :: Ordering
- class Nubable t
- nub :: Nubable t => Map t -> Map (Nub t)
- type family Lookup (m :: [Mapping k v]) (c :: k) :: Maybe v where ...
- type family Member (c :: k) (m :: [Mapping k v]) :: Bool where ...
- type family (m :: [Mapping k v]) :\ (c :: k) :: [Mapping k v] where ...
- class Split s t st
- split :: Split s t st => Map st -> (Map s, Map t)
- class IsMember v t m
- lookp :: IsMember v t m => Var v -> Map m -> t
- class Updatable v t m n
- update :: Updatable v t m n => Map m -> Var v -> t -> Map n
- type IsMap s = s ~ Nub (Sort s)
- type AsMap s = Nub (Sort s)
- asMap :: (Sortable s, Nubable (Sort s)) => Map s -> Map (AsMap s)
- class Submap s t
- submap :: Submap s t => Map t -> Map s
Documentation
A key-value pair
k :-> v infixr 4 |
Instances
Updatable v t s ((v :-> t) ': s) Source # | |
IsMember v t m => IsMember v t (x ': m) Source # | |
IsMember v t ((v :-> t) ': m) Source # | |
Updatable v t m n => Updatable v t ((w :-> y) ': m) ((w :-> y) ': n) Source # | |
Updatable v t ((v :-> s) ': m) ((v :-> t) ': m) Source # | |
Submap s t => Submap s (x ': t) Source # | |
Split s t st => Split s (x ': t) (x ': st) Source # | |
(Eq v, Eq (Map s)) => Eq (Map ((k :-> v) ': s)) Source # | |
Eq (Map ([] :: [Mapping Symbol Type])) Source # | |
(Ord v, Ord (Map s)) => Ord (Map ((k :-> v) ': s)) Source # | |
Defined in Data.Type.Map compare :: Map ((k :-> v) ': s) -> Map ((k :-> v) ': s) -> Ordering # (<) :: Map ((k :-> v) ': s) -> Map ((k :-> v) ': s) -> Bool # (<=) :: Map ((k :-> v) ': s) -> Map ((k :-> v) ': s) -> Bool # (>) :: Map ((k :-> v) ': s) -> Map ((k :-> v) ': s) -> Bool # (>=) :: Map ((k :-> v) ': s) -> Map ((k :-> v) ': s) -> Bool # max :: Map ((k :-> v) ': s) -> Map ((k :-> v) ': s) -> Map ((k :-> v) ': s) # min :: Map ((k :-> v) ': s) -> Map ((k :-> v) ': s) -> Map ((k :-> v) ': s) # | |
Ord (Map ([] :: [Mapping Symbol Type])) Source # | |
(KnownSymbol k, Show v, Show' (Map s)) => Show (Map ((k :-> v) ': s)) Source # | |
Show (Map ([] :: [Mapping Symbol Type])) Source # | |
Nubable ([] :: [Mapping Symbol Type]) Source # | |
Submap ([] :: [Mapping Symbol Type]) ([] :: [Mapping Symbol Type]) Source # | |
Split ([] :: [Mapping Symbol Type]) ([] :: [Mapping Symbol Type]) ([] :: [Mapping Symbol Type]) Source # | |
(Nub (e ': (f ': s)) ~ (e ': Nub (f ': s)), Nubable (f ': s)) => Nubable (e ': (f ': s)) Source # | |
Nubable (e ': ([] :: [Mapping Symbol Type])) Source # | |
(Combinable v v', Nubable ((k :-> Combine v v') ': s)) => Nubable ((k :-> v) ': ((k :-> v') ': s)) Source # | |
Split s t st => Split (x ': s) t (x ': st) Source # | |
Submap s t => Submap (x ': s) (x ': t) Source # | |
Split s t st => Split (x ': s) (x ': t) (x ': st) Source # | |
type Cmp (k :-> v2 :: Mapping Symbol v1) (k' :-> v' :: Mapping Symbol v1) Source # | |
union :: Unionable s t => Map s -> Map t -> Map (Union s t) Source #
Union of two finite maps (normalising)
data Map (n :: [Mapping Symbol *]) where Source #
A value-level heterogenously-typed Map (with type-level representation in terms of lists)
Instances
(Eq v, Eq (Map s)) => Eq (Map ((k :-> v) ': s)) Source # | |
Eq (Map ([] :: [Mapping Symbol Type])) Source # | |
(Ord v, Ord (Map s)) => Ord (Map ((k :-> v) ': s)) Source # | |
Defined in Data.Type.Map compare :: Map ((k :-> v) ': s) -> Map ((k :-> v) ': s) -> Ordering # (<) :: Map ((k :-> v) ': s) -> Map ((k :-> v) ': s) -> Bool # (<=) :: Map ((k :-> v) ': s) -> Map ((k :-> v) ': s) -> Bool # (>) :: Map ((k :-> v) ': s) -> Map ((k :-> v) ': s) -> Bool # (>=) :: Map ((k :-> v) ': s) -> Map ((k :-> v) ': s) -> Bool # max :: Map ((k :-> v) ': s) -> Map ((k :-> v) ': s) -> Map ((k :-> v) ': s) # min :: Map ((k :-> v) ': s) -> Map ((k :-> v) ': s) -> Map ((k :-> v) ': s) # | |
Ord (Map ([] :: [Mapping Symbol Type])) Source # | |
(KnownSymbol k, Show v, Show' (Map s)) => Show (Map ((k :-> v) ': s)) Source # | |
Show (Map ([] :: [Mapping Symbol Type])) Source # | |
type family Combine (a :: v) (b :: v) :: v Source #
Open type family for combining values in a map (that have the same key)
type family Cmp (a :: k) (b :: k) :: Ordering Source #
Open-family for the ordering operation in the sort
Instances
Nubable ([] :: [Mapping Symbol Type]) Source # | |
(Nub (e ': (f ': s)) ~ (e ': Nub (f ': s)), Nubable (f ': s)) => Nubable (e ': (f ': s)) Source # | |
Nubable (e ': ([] :: [Mapping Symbol Type])) Source # | |
(Combinable v v', Nubable ((k :-> Combine v v') ': s)) => Nubable ((k :-> v) ': ((k :-> v') ': s)) Source # | |
type family Lookup (m :: [Mapping k v]) (c :: k) :: Maybe v where ... Source #
Type-level lookup of elements from a map
type family Member (c :: k) (m :: [Mapping k v]) :: Bool where ... Source #
Membership test as type function
type family (m :: [Mapping k v]) :\ (c :: k) :: [Mapping k v] where ... Source #
Delete elements from a map by key
Splitting a union of maps, given the maps we want to split it into
Membership test a type class (predicate)
lookp :: IsMember v t m => Var v -> Map m -> t Source #
Value-level lookup of elements from a map, via type class predicate
class Updatable v t m n Source #
Updatability as a type class
update :: Updatable v t m n => Map m -> Var v -> t -> Map n Source #
Update a map with m
at variable v
with a value of type t
to produce a map of type n
asMap :: (Sortable s, Nubable (Sort s)) => Map s -> Map (AsMap s) Source #
At the value level, noramlise the list form to the map form