packed-multikey-map-0.1.0.0: Efficient “spreadsheet table” like maps with multiple marginals

Copyright(c) Justus Sagemüller 2017
LicenseGPL v3
Maintainer(@) jsagemue $ uni-koeln.de
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Data.Map.Multikey.Packed

Contents

Description

 

Synopsis

Multikey maps

data CMap k a Source

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

Instances

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 

empty :: forall k a. Keys k => CMap k a 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.

toList :: Keys k => CMap k a -> [(k, a)] Source

lookup :: Keys k => k -> CMap k a -> Maybe a Source

The class of supported keys

class Eq k => Keys k where Source

Minimal complete definition

useKeys

Associated Types

type LSubkey k :: * Source

type RSubkey k :: * Source

Methods

useKeys :: KeyKey k Source

useKeys' :: proxy k -> KeyKey k Source

type KeyKey k = Either ((k -> (LSubkey k, RSubkey k), LSubkey k -> RSubkey k -> k), Dict (Keys (LSubkey k), Keys (RSubkey k))) (Dict (Ord k)) Source