mono-traversable-0.6.1: Type classes for mapping, folding, and traversing monomorphic containers

Safe HaskellNone
LanguageHaskell2010

Data.Containers

Description

Warning: This module should be considered highly experimental.

Synopsis

Documentation

class (Monoid set, Semigroup set, MonoFoldable set, Eq (ContainerKey set), GrowingAppend set) => SetContainer set where

Associated Types

type ContainerKey set

Methods

member :: ContainerKey set -> set -> Bool

notMember :: ContainerKey set -> set -> Bool

union :: set -> set -> set

difference :: set -> set -> set

intersection :: set -> set -> set

Instances

SetContainer IntSet 
Eq key => SetContainer [(key, value)] 
SetContainer (IntMap value)

This instance uses the functions from Data.IntMap.Strict.

Ord element => SetContainer (Set element) 
(Eq element, Hashable element) => SetContainer (HashSet element) 
Ord k => SetContainer (Map k v)

This instance uses the functions from Data.Map.Strict.

(Eq key, Hashable key) => SetContainer (HashMap key value)

This instance uses the functions from Data.HashMap.Strict.

class PolyMap map where

A guaranteed-polymorphic Map, which allows for more polymorphic versions of functions.

Methods

differenceMap :: map value1 -> map value2 -> map value1

intersectionMap :: map value1 -> map value2 -> map value1

intersectionWithMap :: (value1 -> value2 -> value3) -> map value1 -> map value2 -> map value3

Instances

PolyMap IntMap

This instance uses the functions from Data.IntMap.Strict.

Ord key => PolyMap (Map key)

This instance uses the functions from Data.Map.Strict.

(Eq key, Hashable key) => PolyMap (HashMap key)

This instance uses the functions from Data.HashMap.Strict.

class (MonoTraversable map, SetContainer map) => IsMap map where

Associated Types

type MapValue map

In some cases, MapValue and Element will be different, e.g., the IsMap instance of associated lists.

Methods

lookup :: ContainerKey map -> map -> Maybe (MapValue map)

insertMap :: ContainerKey map -> MapValue map -> map -> map

deleteMap :: ContainerKey map -> map -> map

singletonMap :: ContainerKey map -> MapValue map -> map

mapFromList :: [(ContainerKey map, MapValue map)] -> map

mapToList :: map -> [(ContainerKey map, MapValue map)]

findWithDefault :: MapValue map -> ContainerKey map -> map -> MapValue map

insertWith :: (MapValue map -> MapValue map -> MapValue map) -> ContainerKey map -> MapValue map -> map -> map

insertWithKey :: (ContainerKey map -> MapValue map -> MapValue map -> MapValue map) -> ContainerKey map -> MapValue map -> map -> map

insertLookupWithKey :: (ContainerKey map -> MapValue map -> MapValue map -> MapValue map) -> ContainerKey map -> MapValue map -> map -> (Maybe (MapValue map), map)

adjustMap :: (MapValue map -> MapValue map) -> ContainerKey map -> map -> map

adjustWithKey :: (ContainerKey map -> MapValue map -> MapValue map) -> ContainerKey map -> map -> map

updateMap :: (MapValue map -> Maybe (MapValue map)) -> ContainerKey map -> map -> map

updateWithKey :: (ContainerKey map -> MapValue map -> Maybe (MapValue map)) -> ContainerKey map -> map -> map

updateLookupWithKey :: (ContainerKey map -> MapValue map -> Maybe (MapValue map)) -> ContainerKey map -> map -> (Maybe (MapValue map), map)

alterMap :: (Maybe (MapValue map) -> Maybe (MapValue map)) -> ContainerKey map -> map -> map

unionWith :: (MapValue map -> MapValue map -> MapValue map) -> map -> map -> map

unionWithKey :: (ContainerKey map -> MapValue map -> MapValue map -> MapValue map) -> map -> map -> map

unionsWith :: (MapValue map -> MapValue map -> MapValue map) -> [map] -> map

mapWithKey :: (ContainerKey map -> MapValue map -> MapValue map) -> map -> map

mapKeysWith :: (MapValue map -> MapValue map -> MapValue map) -> (ContainerKey map -> ContainerKey map) -> map -> map

Instances

Eq key => IsMap [(key, value)] 
IsMap (IntMap value)

This instance uses the functions from Data.IntMap.Strict.

Ord key => IsMap (Map key value)

This instance uses the functions from Data.Map.Strict.

(Eq key, Hashable key) => IsMap (HashMap key value)

This instance uses the functions from Data.HashMap.Strict.

class (SetContainer set, Element set ~ ContainerKey set) => IsSet set where

Methods

insertSet :: Element set -> set -> set

deleteSet :: Element set -> set -> set

singletonSet :: Element set -> set

setFromList :: [Element set] -> set

setToList :: set -> [Element set]

Instances

IsSet IntSet 
Ord element => IsSet (Set element) 
(Eq element, Hashable element) => IsSet (HashSet element) 

class MonoFunctor mono => MonoZip mono where

zip operations on MonoFunctors.

Methods

ozipWith :: (Element mono -> Element mono -> Element mono) -> mono -> mono -> mono

ozip :: mono -> mono -> [(Element mono, Element mono)]

ounzip :: [(Element mono, Element mono)] -> (mono, mono)