Copyright | (c) Justus Sagemüller 2017 |
---|---|
License | GPL v3 |
Maintainer | (@) jsagemue $ uni-koeln.de |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
- data CMap k a
- empty :: forall k a. Keys k => CMap k a
- fromList' :: forall k a. Keys k => [(k, a)] -> Maybe (CMap k a)
- toList :: Keys k => CMap k a -> [(k, a)]
- lookup :: Keys k => k -> CMap k a -> Maybe a
- class Eq k => Keys k where
- type KeyKey k = Either ((k -> (LSubkey k, RSubkey k), LSubkey k -> RSubkey k -> k), Dict (Keys (LSubkey k), Keys (RSubkey k))) (Dict (Ord k))
Multikey maps
For keys of types like Int
or String
, this container behaves just
like Map
. But for compound types – tuples, in particular – it demands the
“rectangular property”: if the key (p,x)
is in the map and key (q,y)
too,
then keys (q,x)
and (p,y)
must be present as well.
In other words, such a map can be visualised as a table with all the keys
on two edges and the values in the middle, like, in case of
,CMap
(Int
,String
) Double
"bla" "blub" "foo" 0 3.8 4.1 2.0 1 3.9 6.3 6.3 5 1.0 11.6 2.2 43 54.1 10.0 10.1
Functor (CMap k) Source | |
Foldable (CMap k) Source | |
Traversable (CMap k) Source | |
(Keys k, Eq a) => Eq (CMap k a) Source | |
(Show k, Keys k, Show a) => Show (CMap k a) Source | |
Arbitrary v => Arbitrary (CMap Char v) Source | |
Arbitrary v => Arbitrary (CMap Double v) Source | |
Arbitrary v => Arbitrary (CMap Int v) Source | |
Arbitrary v => Arbitrary (CMap Integer v) Source | |
(Arbitrary c, Ord c, Arbitrary v) => Arbitrary (CMap [c] v) Source | |
(Keys k, Keys l, SplArb k l v) => Arbitrary (CMap (k, l) v) Source | |
(Keys k, Keys l, Keys m, SplArb k (l, m) v) => Arbitrary (CMap (k, l, m) v) Source | |
(Keys k, Keys l, Keys m, Keys n, SplArb (k, l) (m, n) v) => Arbitrary (CMap (k, l, m, n) v) Source |
fromList' :: forall k a. Keys k => [(k, a)] -> Maybe (CMap k a) Source
Build a map, if the given keys fulfill the rectangular property.
The class of supported keys
class Eq k => Keys k where Source
Keys Char Source | |
Keys Double Source | |
Keys Float Source | |
Keys Int Source | |
Keys Int8 Source | |
Keys Int16 Source | |
Keys Int32 Source | |
Keys Int64 Source | |
Keys Integer Source | |
Keys Word Source | |
Keys Word8 Source | |
Keys Word16 Source | |
Keys Word32 Source | |
Keys Word64 Source | |
Keys () Source | |
Keys Void Source | |
Keys Natural Source | |
Ord a => Keys [a] Source | |
Integral a => Keys (Ratio a) Source | |
Ord a => Keys (Maybe a) Source | |
(Ord a, Ord b) => Keys (Either a b) Source | |
(Keys x, Keys y) => Keys (x, y) Source | |
(Keys x, Keys y, Keys z) => Keys (x, y, z) Source | |
(Keys x, Keys y, Keys z, Keys w) => Keys (x, y, z, w) Source |