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

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

 Source # Methodsfmap :: (a -> b) -> TotalArray k a -> TotalArray k b #(<\$) :: a -> TotalArray k b -> TotalArray k a # (Enum k, Bounded k) => Applicative (TotalArray k) Source # Zippy applicative. Complexity: pure O(n), <*> O(n). Methodspure :: a -> TotalArray k a #(<*>) :: TotalArray k (a -> b) -> TotalArray k a -> TotalArray k b #(*>) :: TotalArray k a -> TotalArray k b -> TotalArray k b #(<*) :: TotalArray k a -> TotalArray k b -> TotalArray k a # Source # Methodsfold :: Monoid m => TotalArray k m -> m #foldMap :: Monoid m => (a -> m) -> TotalArray k a -> m #foldr :: (a -> b -> b) -> b -> TotalArray k a -> b #foldr' :: (a -> b -> b) -> b -> TotalArray k a -> b #foldl :: (b -> a -> b) -> b -> TotalArray k a -> b #foldl' :: (b -> a -> b) -> b -> TotalArray k a -> b #foldr1 :: (a -> a -> a) -> TotalArray k a -> a #foldl1 :: (a -> a -> a) -> TotalArray k a -> a #toList :: TotalArray k a -> [a] #null :: TotalArray k a -> Bool #length :: TotalArray k a -> Int #elem :: Eq a => a -> TotalArray k a -> Bool #maximum :: Ord a => TotalArray k a -> a #minimum :: Ord a => TotalArray k a -> a #sum :: Num a => TotalArray k a -> a #product :: Num a => TotalArray k a -> a # Source # Methodstraverse :: Applicative f => (a -> f b) -> TotalArray k a -> f (TotalArray k b) #sequenceA :: Applicative f => TotalArray k (f a) -> f (TotalArray k a) #mapM :: Monad m => (a -> m b) -> TotalArray k a -> m (TotalArray k b) #sequence :: Monad m => TotalArray k (m a) -> m (TotalArray k a) # (Enum k, Bounded k) => Distributive (TotalArray k) Source # Complexity: distribute O(n * fmap) Methodsdistribute :: Functor f => f (TotalArray k a) -> TotalArray k (f a) #collect :: Functor f => (a -> TotalArray k b) -> f a -> TotalArray k (f b) #distributeM :: Monad m => m (TotalArray k a) -> TotalArray k (m a) #collectM :: Monad m => (a -> TotalArray k b) -> m a -> TotalArray k (m b) # (Enum k, Bounded k) => Representable (TotalArray k) Source # Convert from and to a total function.Complexity: tabulate O(n), index O(1) Associated Typestype Rep (TotalArray k :: * -> *) :: * # Methodstabulate :: (Rep (TotalArray k) -> a) -> TotalArray k a #index :: TotalArray k a -> Rep (TotalArray k) -> a # (Enum k, Bounded k) => Serial1 (TotalArray k) Source # Complexity: serializeWith O(n), deserializeWith O(n) MethodsserializeWith :: MonadPut m => (a -> m ()) -> TotalArray k a -> m () #deserializeWith :: MonadGet m => m a -> m (TotalArray k a) # (Enum k, Bounded k) => Keyed (TotalArray k) Source # Complexity: mapWithKey O(n) MethodsmapWithKey :: (Key (TotalArray k) -> a -> b) -> TotalArray k a -> TotalArray k b # Source # Complexity: all O(n) MethodszipWith :: (a -> b -> c) -> TotalArray k a -> TotalArray k b -> TotalArray k c #zip :: TotalArray k a -> TotalArray k b -> TotalArray k (a, b) #zap :: TotalArray k (a -> b) -> TotalArray k a -> TotalArray k b # (Enum k, Bounded k) => ZipWithKey (TotalArray k) Source # Complexity: all O(n) MethodszipWithKey :: (Key (TotalArray k) -> a -> b -> c) -> TotalArray k a -> TotalArray k b -> TotalArray k c #zapWithKey :: TotalArray k (Key (TotalArray k) -> a -> b) -> TotalArray k a -> TotalArray k b # (Enum k, Bounded k) => Indexable (TotalArray k) Source # Complexity: index O(1) Methodsindex :: TotalArray k a -> Key (TotalArray k) -> a # (Enum k, Bounded k) => Lookup (TotalArray k) Source # Complexity: lookup O(1) Methodslookup :: Key (TotalArray k) -> TotalArray k a -> Maybe a # (Enum k, Bounded k) => Adjustable (TotalArray k) Source # Complexity: adjust O(n) Methodsadjust :: (a -> a) -> Key (TotalArray k) -> TotalArray k a -> TotalArray k a #replace :: Key (TotalArray k) -> a -> TotalArray k a -> TotalArray k a # (Enum k, Bounded k) => FoldableWithKey (TotalArray k) Source # Complexity: foldMapWithKey O(n) MethodstoKeyedList :: TotalArray k a -> [(Key (TotalArray k), a)] #foldMapWithKey :: Monoid m => (Key (TotalArray k) -> a -> m) -> TotalArray k a -> m #foldrWithKey :: (Key (TotalArray k) -> a -> b -> b) -> b -> TotalArray k a -> b #foldlWithKey :: (b -> Key (TotalArray k) -> a -> b) -> b -> TotalArray k a -> b # (Enum k, Bounded k) => TraversableWithKey (TotalArray k) Source # Complexity: traverseWithKey O(n) MethodstraverseWithKey :: Applicative f => (Key (TotalArray k) -> a -> f b) -> TotalArray k a -> f (TotalArray k b) #mapWithKeyM :: Monad m => (Key (TotalArray k) -> a -> m b) -> TotalArray k a -> m (TotalArray k b) # (Enum k, Bounded k) => Metric (TotalArray k) Source # Complexity: all O(n) Methodsdot :: Num a => TotalArray k a -> TotalArray k a -> a #quadrance :: Num a => TotalArray k a -> a #qd :: Num a => TotalArray k a -> TotalArray k a -> a #distance :: Floating a => TotalArray k a -> TotalArray k a -> a #norm :: Floating a => TotalArray k a -> a #signorm :: Floating a => TotalArray k a -> TotalArray k a # (Enum k, Bounded k) => Additive (TotalArray k) Source # Complexity: all O(n) Methodszero :: Num a => TotalArray k a #(^+^) :: Num a => TotalArray k a -> TotalArray k a -> TotalArray k a #(^-^) :: Num a => TotalArray k a -> TotalArray k a -> TotalArray k a #lerp :: Num a => a -> TotalArray k a -> TotalArray k a -> TotalArray k a #liftU2 :: (a -> a -> a) -> TotalArray k a -> TotalArray k a -> TotalArray k a #liftI2 :: (a -> b -> c) -> TotalArray k a -> TotalArray k b -> TotalArray k c # Eq a => Eq (TotalArray k a) Source # Methods(==) :: TotalArray k a -> TotalArray k a -> Bool #(/=) :: TotalArray k a -> TotalArray k a -> Bool # Ord a => Ord (TotalArray k a) Source # Methodscompare :: TotalArray k a -> TotalArray k a -> Ordering #(<) :: TotalArray k a -> TotalArray k a -> Bool #(<=) :: TotalArray k a -> TotalArray k a -> Bool #(>) :: TotalArray k a -> TotalArray k a -> Bool #(>=) :: TotalArray k a -> TotalArray k a -> Bool #max :: TotalArray k a -> TotalArray k a -> TotalArray k a #min :: TotalArray k a -> TotalArray k a -> TotalArray k a # Read a => Read (TotalArray k a) Source # MethodsreadsPrec :: Int -> ReadS (TotalArray k a) #readList :: ReadS [TotalArray k a] #readPrec :: ReadPrec (TotalArray k a) # Show a => Show (TotalArray k a) Source # MethodsshowsPrec :: Int -> TotalArray k a -> ShowS #show :: TotalArray k a -> String #showList :: [TotalArray k a] -> ShowS # (Enum k, Bounded k, Serial a) => Serial (TotalArray k a) Source # Complexity: serialize O(n), deserialize O(n) Methodsserialize :: MonadPut m => TotalArray k a -> m () #deserialize :: MonadGet m => m (TotalArray k a) # type Rep (TotalArray k) Source # type Rep (TotalArray k) = k type Key (TotalArray k) Source # type Key (TotalArray k) = k