total-maps-1.0.0.1: Dense and sparse total maps.

LicenseMIT
MaintainerPaweł Nowak <pawel834@gmail.com>
Stabilityprovisional
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Data.Total.Array

Description

Bounded, dense, total map implemented as a vector.

Synopsis

Documentation

newtype TotalArray k a Source

A total map from keys k to values a, represented as an immutable vector.

Warning: the number of keys MUST fit into an Int.

n is equal to the number of keys.

Constructors

TotalArray (Vector a) 

Instances

Functor (TotalArray k) 
(Enum k, Bounded k) => Applicative (TotalArray k)

Zippy applicative. Complexity: pure O(n), <*> O(n).

Foldable (TotalArray k) 
Traversable (TotalArray k) 
(Enum k, Bounded k) => Distributive (TotalArray k)

Complexity: distribute O(n * fmap)

(Enum k, Bounded k) => Representable (TotalArray k)

Convert from and to a total function.

Complexity: tabulate O(n), index O(1)

(Enum k, Bounded k) => Serial1 (TotalArray k)

Complexity: serializeWith O(n), deserializeWith O(n)

(Enum k, Bounded k) => Keyed (TotalArray k)

Complexity: mapWithKey O(n)

Zip (TotalArray k)

Complexity: all O(n)

(Enum k, Bounded k) => ZipWithKey (TotalArray k)

Complexity: all O(n)

(Enum k, Bounded k) => Indexable (TotalArray k)

Complexity: index O(1)

(Enum k, Bounded k) => Lookup (TotalArray k)

Complexity: lookup O(1)

(Enum k, Bounded k) => Adjustable (TotalArray k)

Complexity: adjust O(n)

(Enum k, Bounded k) => FoldableWithKey (TotalArray k)

Complexity: foldMapWithKey O(n)

(Enum k, Bounded k) => TraversableWithKey (TotalArray k)

Complexity: traverseWithKey O(n)

(Enum k, Bounded k) => Metric (TotalArray k)

Complexity: all O(n)

(Enum k, Bounded k) => Additive (TotalArray k)

Complexity: all O(n)

Eq a => Eq (TotalArray k a) 
Ord a => Ord (TotalArray k a) 
Read a => Read (TotalArray k a) 
Show a => Show (TotalArray k a) 
(Enum k, Bounded k, Serial a) => Serial (TotalArray k a)

Complexity: serialize O(n), deserialize O(n)

type Rep (TotalArray k) = k 
type Key (TotalArray k) = k