EdisonCore-1.2.1.3: A library of efficent, purely-functional data structures (Core Implementations)

Portability GHC, Hugs (MPTC and FD) stable robdockins AT fastmail DOT fm

Data.Edison.Assoc.AssocList

Description

This module implements finite maps as simple association lists.

Duplicates are removed conceptually, but not physically. The first occurrence of a given key is the one that is considered to be in the map.

The list type is mildly customized to prevent boxing the pairs.

Synopsis

Type of simple association lists

data FM k a Source

Instances

 Eq k => Functor (FM k) Eq k => AssocX (FM k) k Ord k => OrdAssocX (FM k) k Eq k => FiniteMapX (FM k) k Ord k => OrdFiniteMapX (FM k) k Eq k => Assoc (FM k) k Ord k => OrdAssoc (FM k) k Eq k => FiniteMap (FM k) k Ord k => OrdFiniteMap (FM k) k (Eq k, Eq a) => Eq (FM k a) (Ord k, Ord a) => Ord (FM k a) (Eq k, Read k, Read a) => Read (FM k a) (Eq k, Show k, Show a) => Show (FM k a) (Eq k, Arbitrary k, Arbitrary a) => Arbitrary (FM k a) Eq k => Monoid (FM k a)

AssocX operations

empty :: Eq k => FM k aSource

singleton :: Eq k => k -> a -> FM k aSource

fromSeq :: (Eq k, Sequence seq) => seq (k, a) -> FM k aSource

insert :: Eq k => k -> a -> FM k a -> FM k aSource

insertSeq :: (Eq k, Sequence seq) => seq (k, a) -> FM k a -> FM k aSource

union :: Eq k => FM k a -> FM k a -> FM k aSource

unionSeq :: (Eq k, Sequence seq) => seq (FM k a) -> FM k aSource

delete :: Eq k => k -> FM k a -> FM k aSource

deleteAll :: Eq k => k -> FM k a -> FM k aSource

deleteSeq :: (Eq k, Sequence seq) => seq k -> FM k a -> FM k aSource

null :: Eq k => FM k a -> BoolSource

size :: Eq k => FM k a -> IntSource

member :: Eq k => k -> FM k a -> BoolSource

count :: Eq k => k -> FM k a -> IntSource

lookup :: Eq k => k -> FM k a -> aSource

lookupM :: (Eq k, Monad rm) => k -> FM k a -> rm aSource

lookupAll :: (Eq k, Sequence seq) => k -> FM k a -> seq aSource

lookupAndDelete :: Eq k => k -> FM k a -> (a, FM k a)Source

lookupAndDeleteM :: (Eq k, Monad rm) => k -> FM k a -> rm (a, FM k a)Source

lookupAndDeleteAll :: (Eq k, Sequence seq) => k -> FM k a -> (seq a, FM k a)Source

lookupWithDefault :: Eq k => a -> k -> FM k a -> aSource

adjust :: Eq k => (a -> a) -> k -> FM k a -> FM k aSource

adjustAll :: Eq k => (a -> a) -> k -> FM k a -> FM k aSource

adjustOrInsert :: Eq k => (a -> a) -> a -> k -> FM k a -> FM k aSource

adjustAllOrInsert :: Eq k => (a -> a) -> a -> k -> FM k a -> FM k aSource

adjustOrDelete :: Eq k => (a -> Maybe a) -> k -> FM k a -> FM k aSource

adjustOrDeleteAll :: Eq k => (a -> Maybe a) -> k -> FM k a -> FM k aSource

strict :: FM k a -> FM k aSource

strictWith :: (a -> b) -> FM k a -> FM k aSource

map :: Eq k => (a -> b) -> FM k a -> FM k bSource

fold :: Eq k => (a -> b -> b) -> b -> FM k a -> bSource

fold' :: Eq k => (a -> b -> b) -> b -> FM k a -> bSource

fold1 :: Eq k => (a -> a -> a) -> FM k a -> aSource

fold1' :: Eq k => (a -> a -> a) -> FM k a -> aSource

filter :: Eq k => (a -> Bool) -> FM k a -> FM k aSource

partition :: Eq k => (a -> Bool) -> FM k a -> (FM k a, FM k a)Source

elements :: (Eq k, Sequence seq) => FM k a -> seq aSource

OrdAssocX operations

minView :: (Ord k, Monad m) => FM k a -> m (a, FM k a)Source

minElem :: Ord k => FM k a -> aSource

deleteMin :: Ord k => FM k a -> FM k aSource

unsafeInsertMin :: Ord k => k -> a -> FM k a -> FM k aSource

maxView :: (Ord k, Monad m) => FM k a -> m (a, FM k a)Source

maxElem :: Ord k => FM k a -> aSource

deleteMax :: Ord k => FM k a -> FM k aSource

unsafeInsertMax :: Ord k => k -> a -> FM k a -> FM k aSource

foldr :: Ord k => (a -> b -> b) -> b -> FM k a -> bSource

foldr' :: Ord k => (a -> b -> b) -> b -> FM k a -> bSource

foldl :: Ord k => (b -> a -> b) -> b -> FM k a -> bSource

foldl' :: Ord k => (b -> a -> b) -> b -> FM k a -> bSource

foldr1 :: Ord k => (a -> a -> a) -> FM k a -> aSource

foldr1' :: Ord k => (a -> a -> a) -> FM k a -> aSource

foldl1 :: Ord k => (a -> a -> a) -> FM k a -> aSource

foldl1' :: Ord k => (a -> a -> a) -> FM k a -> aSource

unsafeFromOrdSeq :: (Ord k, Sequence seq) => seq (k, a) -> FM k aSource

unsafeAppend :: Ord k => FM k a -> FM k a -> FM k aSource

filterLT :: Ord k => k -> FM k a -> FM k aSource

filterLE :: Ord k => k -> FM k a -> FM k aSource

filterGT :: Ord k => k -> FM k a -> FM k aSource

filterGE :: Ord k => k -> FM k a -> FM k aSource

partitionLT_GE :: Ord k => k -> FM k a -> (FM k a, FM k a)Source

partitionLE_GT :: Ord k => k -> FM k a -> (FM k a, FM k a)Source

partitionLT_GT :: Ord k => k -> FM k a -> (FM k a, FM k a)Source

Assoc operations

toSeq :: (Eq k, Sequence seq) => FM k a -> seq (k, a)Source

keys :: (Eq k, Sequence seq) => FM k a -> seq kSource

mapWithKey :: Eq k => (k -> a -> b) -> FM k a -> FM k bSource

foldWithKey :: Eq k => (k -> a -> b -> b) -> b -> FM k a -> bSource

foldWithKey' :: Eq k => (k -> a -> b -> b) -> b -> FM k a -> bSource

filterWithKey :: Eq k => (k -> a -> Bool) -> FM k a -> FM k aSource

partitionWithKey :: Eq k => (k -> a -> Bool) -> FM k a -> (FM k a, FM k a)Source

OrdAssoc operations

minViewWithKey :: (Ord k, Monad m) => FM k a -> m ((k, a), FM k a)Source

minElemWithKey :: Ord k => FM k a -> (k, a)Source

maxViewWithKey :: (Ord k, Monad m) => FM k a -> m ((k, a), FM k a)Source

maxElemWithKey :: Ord k => FM k a -> (k, a)Source

foldrWithKey :: Ord k => (k -> a -> b -> b) -> b -> FM k a -> bSource

foldrWithKey' :: Ord k => (k -> a -> b -> b) -> b -> FM k a -> bSource

foldlWithKey :: Ord k => (b -> k -> a -> b) -> b -> FM k a -> bSource

foldlWithKey' :: Ord k => (b -> k -> a -> b) -> b -> FM k a -> bSource

toOrdSeq :: (Ord k, Sequence seq) => FM k a -> seq (k, a)Source

FiniteMapX operations

fromSeqWith :: (Eq k, Sequence seq) => (a -> a -> a) -> seq (k, a) -> FM k aSource

fromSeqWithKey :: (Eq k, Sequence seq) => (k -> a -> a -> a) -> seq (k, a) -> FM k aSource

insertWith :: Eq k => (a -> a -> a) -> k -> a -> FM k a -> FM k aSource

insertWithKey :: Eq k => (k -> a -> a -> a) -> k -> a -> FM k a -> FM k aSource

insertSeqWith :: (Eq k, Sequence seq) => (a -> a -> a) -> seq (k, a) -> FM k a -> FM k aSource

insertSeqWithKey :: (Eq k, Sequence seq) => (k -> a -> a -> a) -> seq (k, a) -> FM k a -> FM k aSource

unionl :: Eq k => FM k a -> FM k a -> FM k aSource

unionr :: Eq k => FM k a -> FM k a -> FM k aSource

unionWith :: Eq k => (a -> a -> a) -> FM k a -> FM k a -> FM k aSource

unionSeqWith :: (Eq k, Sequence seq) => (a -> a -> a) -> seq (FM k a) -> FM k aSource

intersectionWith :: Eq k => (a -> b -> c) -> FM k a -> FM k b -> FM k cSource

difference :: Eq k => FM k a -> FM k b -> FM k aSource

properSubset :: Eq k => FM k a -> FM k b -> BoolSource

subset :: Eq k => FM k a -> FM k b -> BoolSource

properSubmapBy :: Eq k => (a -> a -> Bool) -> FM k a -> FM k a -> BoolSource

submapBy :: Eq k => (a -> a -> Bool) -> FM k a -> FM k a -> BoolSource

sameMapBy :: Eq k => (a -> a -> Bool) -> FM k a -> FM k a -> BoolSource

properSubmap :: (Eq k, Eq a) => FM k a -> FM k a -> BoolSource

submap :: (Eq k, Eq a) => FM k a -> FM k a -> BoolSource

sameMap :: (Eq k, Eq a) => FM k a -> FM k a -> BoolSource

FiniteMap operations

unionWithKey :: Eq k => (k -> a -> a -> a) -> FM k a -> FM k a -> FM k aSource

unionSeqWithKey :: (Eq k, Sequence seq) => (k -> a -> a -> a) -> seq (FM k a) -> FM k aSource

intersectionWithKey :: Eq k => (k -> a -> b -> c) -> FM k a -> FM k b -> FM k cSource