EdisonCore-1.3.2.1: A library of efficient, purely-functional data structures (Core Implementations)

Copyright Copyright (c) 1998 2008 Chris Okasaki MIT; see COPYRIGHT file for terms and conditions robdockins AT fastmail DOT fm stable GHC, Hugs (MPTC and FD) None Haskell2010

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

# AssocX operations

empty :: Eq k => FM k a Source #

singleton :: Eq k => k -> a -> FM k a Source #

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

insert :: Eq k => k -> a -> FM k a -> FM k a Source #

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

union :: Eq k => FM k a -> FM k a -> FM k a Source #

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

delete :: Eq k => k -> FM k a -> FM k a Source #

deleteAll :: Eq k => k -> FM k a -> FM k a Source #

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

null :: Eq k => FM k a -> Bool Source #

size :: Eq k => FM k a -> Int Source #

member :: Eq k => k -> FM k a -> Bool Source #

count :: Eq k => k -> FM k a -> Int Source #

lookup :: Eq k => k -> FM k a -> a Source #

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

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

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 -> a Source #

adjust :: Eq k => (a -> a) -> k -> FM k a -> FM k a Source #

adjustAll :: Eq k => (a -> a) -> k -> FM k a -> FM k a Source #

adjustOrInsert :: Eq k => (a -> a) -> a -> k -> FM k a -> FM k a Source #

adjustAllOrInsert :: Eq k => (a -> a) -> a -> k -> FM k a -> FM k a Source #

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

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

strict :: FM k a -> FM k a Source #

strictWith :: (a -> b) -> FM k a -> FM k a Source #

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

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

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

fold1 :: Eq k => (a -> a -> a) -> FM k a -> a Source #

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

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

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

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

# OrdAssocX operations

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

minElem :: Ord k => FM k a -> a Source #

deleteMin :: Ord k => FM k a -> FM k a Source #

unsafeInsertMin :: Ord k => k -> a -> FM k a -> FM k a Source #

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

maxElem :: Ord k => FM k a -> a Source #

deleteMax :: Ord k => FM k a -> FM k a Source #

unsafeInsertMax :: Ord k => k -> a -> FM k a -> FM k a Source #

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

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

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

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

foldr1 :: Ord k => (a -> a -> a) -> FM k a -> a Source #

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

foldl1 :: Ord k => (a -> a -> a) -> FM k a -> a Source #

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

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

unsafeAppend :: Ord k => FM k a -> FM k a -> FM k a Source #

filterLT :: Ord k => k -> FM k a -> FM k a Source #

filterLE :: Ord k => k -> FM k a -> FM k a Source #

filterGT :: Ord k => k -> FM k a -> FM k a Source #

filterGE :: Ord k => k -> FM k a -> FM k a Source #

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 k Source #

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

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

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

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

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 -> b Source #

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

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

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

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 a Source #

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

insertWith :: Eq k => (a -> a -> a) -> k -> a -> FM k a -> FM k a Source #

insertWithKey :: Eq k => (k -> a -> a -> a) -> k -> a -> FM k a -> FM k a Source #

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

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

unionl :: Eq k => FM k a -> FM k a -> FM k a Source #

unionr :: Eq k => FM k a -> FM k a -> FM k a Source #

unionWith :: Eq k => (a -> a -> a) -> FM k a -> FM k a -> FM k a Source #

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

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

difference :: Eq k => FM k a -> FM k b -> FM k a Source #

properSubset :: Eq k => FM k a -> FM k b -> Bool Source #

subset :: Eq k => FM k a -> FM k b -> Bool Source #

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

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

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

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

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

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

# FiniteMap operations

unionWithKey :: Eq k => (k -> a -> a -> a) -> FM k a -> FM k a -> FM k a Source #

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

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