Data.Containers

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

Safe Haskell | None
Language | Haskell2010

Data.Containers

Description

Warning: This module should be considered highly experimental.

Synopsis

- class (Monoid set, Semigroup set, MonoFoldable set, Eq (ContainerKey set), GrowingAppend set) => SetContainer set where
  - type ContainerKey set
- class PolyMap map where
- class BiPolyMap map where
  - type BPMKeyConstraint map key :: Constraint
- class (MonoTraversable map, SetContainer map) => IsMap map where
  - type MapValue map
- class (SetContainer set, Element set ~ ContainerKey set) => IsSet set where
- class MonoFunctor mono => MonoZip mono where
- class SetContainer set => HasKeysSet set where
  - type KeySet set

# Documentation

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

A container whose values are stored in Key-Value pairs.

Minimal complete definition

member, notMember, union, difference, intersection, keys

Associated Types

type ContainerKey set #

The type of the key

Methods

member :: ContainerKey set -> set -> Bool #

Check if there is a value with the supplied key in the container.

notMember :: ContainerKey set -> set -> Bool #

Check if there isn't a value with the supplied key in the container.

union :: set -> set -> set #

Get the union of two containers.

unions :: (MonoFoldable mono, Element mono ~ set) => mono -> set #

Combine a collection of `SetContainer`s, with left-most values overriding when there are matching keys.

Since: 1.0.0

difference :: set -> set -> set #

Get the difference of two containers.

intersection :: set -> set -> set #

Get the intersection of two containers.

keys :: set -> [ContainerKey set] #

Get a list of all of the keys in the container.

Instances

SetContainer IntSet # |
Associated Types type ContainerKey IntSet :: * # Methods member :: ContainerKey IntSet -> IntSet -> Bool # notMember :: ContainerKey IntSet -> IntSet -> Bool # union :: IntSet -> IntSet -> IntSet # unions :: (MonoFoldable mono, (* ~ Element mono) IntSet) => mono -> IntSet # difference :: IntSet -> IntSet -> IntSet # intersection :: IntSet -> IntSet -> IntSet # keys :: IntSet -> [ContainerKey IntSet] #
Eq key => SetContainer [(key, value)] # |
Associated Types type ContainerKey [(key, value)] :: * # Methods member :: ContainerKey [(key, value)] -> [(key, value)] -> Bool # notMember :: ContainerKey [(key, value)] -> [(key, value)] -> Bool # union :: [(key, value)] -> [(key, value)] -> [(key, value)] # unions :: (MonoFoldable mono, (* ~ Element mono) [(key, value)]) => mono -> [(key, value)] # difference :: [(key, value)] -> [(key, value)] -> [(key, value)] # intersection :: [(key, value)] -> [(key, value)] -> [(key, value)] # keys :: [(key, value)] -> [ContainerKey [(key, value)]] #
SetContainer (IntMap value) # | This instance uses the functions from Data.IntMap.Strict.
Associated Types type ContainerKey (IntMap value) :: * # Methods member :: ContainerKey (IntMap value) -> IntMap value -> Bool # notMember :: ContainerKey (IntMap value) -> IntMap value -> Bool # union :: IntMap value -> IntMap value -> IntMap value # unions :: (MonoFoldable mono, (* ~ Element mono) (IntMap value)) => mono -> IntMap value # difference :: IntMap value -> IntMap value -> IntMap value # intersection :: IntMap value -> IntMap value -> IntMap value # keys :: IntMap value -> [ContainerKey (IntMap value)] #
Ord element => SetContainer (Set element) # |
Associated Types type ContainerKey (Set element) :: * # Methods member :: ContainerKey (Set element) -> Set element -> Bool # notMember :: ContainerKey (Set element) -> Set element -> Bool # union :: Set element -> Set element -> Set element # unions :: (MonoFoldable mono, (* ~ Element mono) (Set element)) => mono -> Set element # difference :: Set element -> Set element -> Set element # intersection :: Set element -> Set element -> Set element # keys :: Set element -> [ContainerKey (Set element)] #
(Eq element, Hashable element) => SetContainer (HashSet element) # |
Associated Types type ContainerKey (HashSet element) :: * # Methods member :: ContainerKey (HashSet element) -> HashSet element -> Bool # notMember :: ContainerKey (HashSet element) -> HashSet element -> Bool # union :: HashSet element -> HashSet element -> HashSet element # unions :: (MonoFoldable mono, (* ~ Element mono) (HashSet element)) => mono -> HashSet element # difference :: HashSet element -> HashSet element -> HashSet element # intersection :: HashSet element -> HashSet element -> HashSet element # keys :: HashSet element -> [ContainerKey (HashSet element)] #
Ord k => SetContainer (Map k v) # | This instance uses the functions from Data.Map.Strict.
Associated Types type ContainerKey (Map k v) :: * # Methods member :: ContainerKey (Map k v) -> Map k v -> Bool # notMember :: ContainerKey (Map k v) -> Map k v -> Bool # union :: Map k v -> Map k v -> Map k v # unions :: (MonoFoldable mono, (* ~ Element mono) (Map k v)) => mono -> Map k v # difference :: Map k v -> Map k v -> Map k v # intersection :: Map k v -> Map k v -> Map k v # keys :: Map k v -> [ContainerKey (Map k v)] #
(Eq key, Hashable key) => SetContainer (HashMap key value) # | This instance uses the functions from Data.HashMap.Strict.
Associated Types type ContainerKey (HashMap key value) :: * # Methods member :: ContainerKey (HashMap key value) -> HashMap key value -> Bool # notMember :: ContainerKey (HashMap key value) -> HashMap key value -> Bool # union :: HashMap key value -> HashMap key value -> HashMap key value # unions :: (MonoFoldable mono, (* ~ Element mono) (HashMap key value)) => mono -> HashMap key value # difference :: HashMap key value -> HashMap key value -> HashMap key value # intersection :: HashMap key value -> HashMap key value -> HashMap key value # keys :: HashMap key value -> [ContainerKey (HashMap key value)] #

class PolyMap map where #

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

Minimal complete definition

differenceMap, intersectionMap, intersectionWithMap

Methods

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

Get the difference between two maps, using the left map's values.

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

Get the intersection of two maps, using the left map's values.

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

Get the intersection of two maps with a supplied function that takes in the left map's value and the right map's value.

Instances

PolyMap IntMap # | This instance uses the functions from Data.IntMap.Strict.
Methods differenceMap :: IntMap value1 -> IntMap value2 -> IntMap value1 # intersectionMap :: IntMap value1 -> IntMap value2 -> IntMap value1 # intersectionWithMap :: (value1 -> value2 -> value3) -> IntMap value1 -> IntMap value2 -> IntMap value3 #
Ord key => PolyMap (Map key) # | This instance uses the functions from Data.Map.Strict.
Methods differenceMap :: Map key value1 -> Map key value2 -> Map key value1 # intersectionMap :: Map key value1 -> Map key value2 -> Map key value1 # intersectionWithMap :: (value1 -> value2 -> value3) -> Map key value1 -> Map key value2 -> Map key value3 #
(Eq key, Hashable key) => PolyMap (HashMap key) # | This instance uses the functions from Data.HashMap.Strict.
Methods differenceMap :: HashMap key value1 -> HashMap key value2 -> HashMap key value1 # intersectionMap :: HashMap key value1 -> HashMap key value2 -> HashMap key value1 # intersectionWithMap :: (value1 -> value2 -> value3) -> HashMap key value1 -> HashMap key value2 -> HashMap key value3 #

class BiPolyMap map where #

A `Map` type polymorphic in both its key and value.

Minimal complete definition

mapKeysWith

Associated Types

type BPMKeyConstraint map key :: Constraint #

Methods

mapKeysWith :: (BPMKeyConstraint map k1, BPMKeyConstraint map k2) => (v -> v -> v) -> (k1 -> k2) -> map k1 v -> map k2 v #

Instances

BiPolyMap Map # |
Associated Types type BPMKeyConstraint (Map :: * -> * -> *) key :: Constraint # Methods mapKeysWith :: (BPMKeyConstraint Map k1, BPMKeyConstraint Map k2) => (v -> v -> v) -> (k1 -> k2) -> Map k1 v -> Map k2 v #
BiPolyMap HashMap # |
Associated Types type BPMKeyConstraint (HashMap :: * -> * -> *) key :: Constraint # Methods mapKeysWith :: (BPMKeyConstraint HashMap k1, BPMKeyConstraint HashMap k2) => (v -> v -> v) -> (k1 -> k2) -> HashMap k1 v -> HashMap k2 v #

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

Polymorphic typeclass for interacting with different map types

Minimal complete definition

lookup, insertMap, deleteMap, singletonMap, mapFromList, mapToList

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) #

Look up a value in a map with a specified key.

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

Insert a key-value pair into a map.

deleteMap :: ContainerKey map -> map -> map #

Delete a key-value pair of a map using a specified key.

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

Create a map from a single key-value pair.

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

Convert a list of key-value pairs to a map

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

Convert a map to a list of key-value pairs.

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

Like `lookup`, but uses a default value when the key does not exist in the map.

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

Insert a key-value pair into a map.

Inserts the value directly if the key does not exist in the map. Otherwise, apply a supplied function that accepts the new value and the previous value and insert that result into the map.

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

Insert a key-value pair into a map.

Inserts the value directly if the key does not exist in the map. Otherwise, apply a supplied function that accepts the key, the new value, and the previous value and insert that result into the map.

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

Insert a key-value pair into a map, return the previous key's value if it existed.

Inserts the value directly if the key does not exist in the map. Otherwise, apply a supplied function that accepts the key, the new value, and the previous value and insert that result into the map.

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

Apply a function to the value of a given key.

Returns the input map when the key-value pair does not exist.

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

Equivalent to `adjustMap`, but the function accepts the key, as well as the previous value.

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

Apply a function to the value of a given key.

If the function returns `Nothing`, this deletes the key-value pair.

Returns the input map when the key-value pair does not exist.

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

Equivalent to `updateMap`, but the function accepts the key, as well as the previous value.

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

Apply a function to the value of a given key.

If the map does not contain the key this returns `Nothing` and the input map.

If the map does contain the key but the function returns `Nothing`, this returns the previous value and the map with the key-value pair removed.

If the map contains the key and the function returns a value, this returns the new value and the map with the key-value pair with the new value.

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

Update/Delete the value of a given key.

Applies a function to previous value of a given key, if it results in `Nothing` delete the key-value pair from the map, otherwise replace the previous value with the new value.

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

Combine two maps.

When a key exists in both maps, apply a function to both of the values and use the result of that as the value of the key in the resulting map.

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

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

Combine a list of maps.

When a key exists in two different maps, apply a function to both of the values and use the result of that as the value of the key in the resulting map.

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

Apply a function over every key-value pair of a map.

omapKeysWith :: (MapValue map -> MapValue map -> MapValue map) -> (ContainerKey map -> ContainerKey map) -> map -> map #

Apply a function over every key of a pair and run `unionsWith` over the results.

Instances

Eq key => IsMap [(key, value)] # |
Associated Types type MapValue [(key, value)] :: * # Methods lookup :: ContainerKey [(key, value)] -> [(key, value)] -> Maybe (MapValue [(key, value)]) # insertMap :: ContainerKey [(key, value)] -> MapValue [(key, value)] -> [(key, value)] -> [(key, value)] # deleteMap :: ContainerKey [(key, value)] -> [(key, value)] -> [(key, value)] # singletonMap :: ContainerKey [(key, value)] -> MapValue [(key, value)] -> [(key, value)] # mapFromList :: [(ContainerKey [(key, value)], MapValue [(key, value)])] -> [(key, value)] # mapToList :: [(key, value)] -> [(ContainerKey [(key, value)], MapValue [(key, value)])] # findWithDefault :: MapValue [(key, value)] -> ContainerKey [(key, value)] -> [(key, value)] -> MapValue [(key, value)] # insertWith :: (MapValue [(key, value)] -> MapValue [(key, value)] -> MapValue [(key, value)]) -> ContainerKey [(key, value)] -> MapValue [(key, value)] -> [(key, value)] -> [(key, value)] # insertWithKey :: (ContainerKey [(key, value)] -> MapValue [(key, value)] -> MapValue [(key, value)] -> MapValue [(key, value)]) -> ContainerKey [(key, value)] -> MapValue [(key, value)] -> [(key, value)] -> [(key, value)] # insertLookupWithKey :: (ContainerKey [(key, value)] -> MapValue [(key, value)] -> MapValue [(key, value)] -> MapValue [(key, value)]) -> ContainerKey [(key, value)] -> MapValue [(key, value)] -> [(key, value)] -> (Maybe (MapValue [(key, value)]), [(key, value)]) # adjustMap :: (MapValue [(key, value)] -> MapValue [(key, value)]) -> ContainerKey [(key, value)] -> [(key, value)] -> [(key, value)] # adjustWithKey :: (ContainerKey [(key, value)] -> MapValue [(key, value)] -> MapValue [(key, value)]) -> ContainerKey [(key, value)] -> [(key, value)] -> [(key, value)] # updateMap :: (MapValue [(key, value)] -> Maybe (MapValue [(key, value)])) -> ContainerKey [(key, value)] -> [(key, value)] -> [(key, value)] # updateWithKey :: (ContainerKey [(key, value)] -> MapValue [(key, value)] -> Maybe (MapValue [(key, value)])) -> ContainerKey [(key, value)] -> [(key, value)] -> [(key, value)] # updateLookupWithKey :: (ContainerKey [(key, value)] -> MapValue [(key, value)] -> Maybe (MapValue [(key, value)])) -> ContainerKey [(key, value)] -> [(key, value)] -> (Maybe (MapValue [(key, value)]), [(key, value)]) # alterMap :: (Maybe (MapValue [(key, value)]) -> Maybe (MapValue [(key, value)])) -> ContainerKey [(key, value)] -> [(key, value)] -> [(key, value)] # unionWith :: (MapValue [(key, value)] -> MapValue [(key, value)] -> MapValue [(key, value)]) -> [(key, value)] -> [(key, value)] -> [(key, value)] # unionWithKey :: (ContainerKey [(key, value)] -> MapValue [(key, value)] -> MapValue [(key, value)] -> MapValue [(key, value)]) -> [(key, value)] -> [(key, value)] -> [(key, value)] # unionsWith :: (MapValue [(key, value)] -> MapValue [(key, value)] -> MapValue [(key, value)]) -> [[(key, value)]] -> [(key, value)] # mapWithKey :: (ContainerKey [(key, value)] -> MapValue [(key, value)] -> MapValue [(key, value)]) -> [(key, value)] -> [(key, value)] # omapKeysWith :: (MapValue [(key, value)] -> MapValue [(key, value)] -> MapValue [(key, value)]) -> (ContainerKey [(key, value)] -> ContainerKey [(key, value)]) -> [(key, value)] -> [(key, value)] #
IsMap (IntMap value) # | This instance uses the functions from Data.IntMap.Strict.
Associated Types type MapValue (IntMap value) :: * # Methods lookup :: ContainerKey (IntMap value) -> IntMap value -> Maybe (MapValue (IntMap value)) # insertMap :: ContainerKey (IntMap value) -> MapValue (IntMap value) -> IntMap value -> IntMap value # deleteMap :: ContainerKey (IntMap value) -> IntMap value -> IntMap value # singletonMap :: ContainerKey (IntMap value) -> MapValue (IntMap value) -> IntMap value # mapFromList :: [(ContainerKey (IntMap value), MapValue (IntMap value))] -> IntMap value # mapToList :: IntMap value -> [(ContainerKey (IntMap value), MapValue (IntMap value))] # findWithDefault :: MapValue (IntMap value) -> ContainerKey (IntMap value) -> IntMap value -> MapValue (IntMap value) # insertWith :: (MapValue (IntMap value) -> MapValue (IntMap value) -> MapValue (IntMap value)) -> ContainerKey (IntMap value) -> MapValue (IntMap value) -> IntMap value -> IntMap value # insertWithKey :: (ContainerKey (IntMap value) -> MapValue (IntMap value) -> MapValue (IntMap value) -> MapValue (IntMap value)) -> ContainerKey (IntMap value) -> MapValue (IntMap value) -> IntMap value -> IntMap value # insertLookupWithKey :: (ContainerKey (IntMap value) -> MapValue (IntMap value) -> MapValue (IntMap value) -> MapValue (IntMap value)) -> ContainerKey (IntMap value) -> MapValue (IntMap value) -> IntMap value -> (Maybe (MapValue (IntMap value)), IntMap value) # adjustMap :: (MapValue (IntMap value) -> MapValue (IntMap value)) -> ContainerKey (IntMap value) -> IntMap value -> IntMap value # adjustWithKey :: (ContainerKey (IntMap value) -> MapValue (IntMap value) -> MapValue (IntMap value)) -> ContainerKey (IntMap value) -> IntMap value -> IntMap value # updateMap :: (MapValue (IntMap value) -> Maybe (MapValue (IntMap value))) -> ContainerKey (IntMap value) -> IntMap value -> IntMap value # updateWithKey :: (ContainerKey (IntMap value) -> MapValue (IntMap value) -> Maybe (MapValue (IntMap value))) -> ContainerKey (IntMap value) -> IntMap value -> IntMap value # updateLookupWithKey :: (ContainerKey (IntMap value) -> MapValue (IntMap value) -> Maybe (MapValue (IntMap value))) -> ContainerKey (IntMap value) -> IntMap value -> (Maybe (MapValue (IntMap value)), IntMap value) # alterMap :: (Maybe (MapValue (IntMap value)) -> Maybe (MapValue (IntMap value))) -> ContainerKey (IntMap value) -> IntMap value -> IntMap value # unionWith :: (MapValue (IntMap value) -> MapValue (IntMap value) -> MapValue (IntMap value)) -> IntMap value -> IntMap value -> IntMap value # unionWithKey :: (ContainerKey (IntMap value) -> MapValue (IntMap value) -> MapValue (IntMap value) -> MapValue (IntMap value)) -> IntMap value -> IntMap value -> IntMap value # unionsWith :: (MapValue (IntMap value) -> MapValue (IntMap value) -> MapValue (IntMap value)) -> [IntMap value] -> IntMap value # mapWithKey :: (ContainerKey (IntMap value) -> MapValue (IntMap value) -> MapValue (IntMap value)) -> IntMap value -> IntMap value # omapKeysWith :: (MapValue (IntMap value) -> MapValue (IntMap value) -> MapValue (IntMap value)) -> (ContainerKey (IntMap value) -> ContainerKey (IntMap value)) -> IntMap value -> IntMap value #
Ord key => IsMap (Map key value) # | This instance uses the functions from Data.Map.Strict.
Associated Types type MapValue (Map key value) :: * # Methods lookup :: ContainerKey (Map key value) -> Map key value -> Maybe (MapValue (Map key value)) # insertMap :: ContainerKey (Map key value) -> MapValue (Map key value) -> Map key value -> Map key value # deleteMap :: ContainerKey (Map key value) -> Map key value -> Map key value # singletonMap :: ContainerKey (Map key value) -> MapValue (Map key value) -> Map key value # mapFromList :: [(ContainerKey (Map key value), MapValue (Map key value))] -> Map key value # mapToList :: Map key value -> [(ContainerKey (Map key value), MapValue (Map key value))] # findWithDefault :: MapValue (Map key value) -> ContainerKey (Map key value) -> Map key value -> MapValue (Map key value) # insertWith :: (MapValue (Map key value) -> MapValue (Map key value) -> MapValue (Map key value)) -> ContainerKey (Map key value) -> MapValue (Map key value) -> Map key value -> Map key value # insertWithKey :: (ContainerKey (Map key value) -> MapValue (Map key value) -> MapValue (Map key value) -> MapValue (Map key value)) -> ContainerKey (Map key value) -> MapValue (Map key value) -> Map key value -> Map key value # insertLookupWithKey :: (ContainerKey (Map key value) -> MapValue (Map key value) -> MapValue (Map key value) -> MapValue (Map key value)) -> ContainerKey (Map key value) -> MapValue (Map key value) -> Map key value -> (Maybe (MapValue (Map key value)), Map key value) # adjustMap :: (MapValue (Map key value) -> MapValue (Map key value)) -> ContainerKey (Map key value) -> Map key value -> Map key value # adjustWithKey :: (ContainerKey (Map key value) -> MapValue (Map key value) -> MapValue (Map key value)) -> ContainerKey (Map key value) -> Map key value -> Map key value # updateMap :: (MapValue (Map key value) -> Maybe (MapValue (Map key value))) -> ContainerKey (Map key value) -> Map key value -> Map key value # updateWithKey :: (ContainerKey (Map key value) -> MapValue (Map key value) -> Maybe (MapValue (Map key value))) -> ContainerKey (Map key value) -> Map key value -> Map key value # updateLookupWithKey :: (ContainerKey (Map key value) -> MapValue (Map key value) -> Maybe (MapValue (Map key value))) -> ContainerKey (Map key value) -> Map key value -> (Maybe (MapValue (Map key value)), Map key value) # alterMap :: (Maybe (MapValue (Map key value)) -> Maybe (MapValue (Map key value))) -> ContainerKey (Map key value) -> Map key value -> Map key value # unionWith :: (MapValue (Map key value) -> MapValue (Map key value) -> MapValue (Map key value)) -> Map key value -> Map key value -> Map key value # unionWithKey :: (ContainerKey (Map key value) -> MapValue (Map key value) -> MapValue (Map key value) -> MapValue (Map key value)) -> Map key value -> Map key value -> Map key value # unionsWith :: (MapValue (Map key value) -> MapValue (Map key value) -> MapValue (Map key value)) -> [Map key value] -> Map key value # mapWithKey :: (ContainerKey (Map key value) -> MapValue (Map key value) -> MapValue (Map key value)) -> Map key value -> Map key value # omapKeysWith :: (MapValue (Map key value) -> MapValue (Map key value) -> MapValue (Map key value)) -> (ContainerKey (Map key value) -> ContainerKey (Map key value)) -> Map key value -> Map key value #
(Eq key, Hashable key) => IsMap (HashMap key value) # | This instance uses the functions from Data.HashMap.Strict.
Associated Types type MapValue (HashMap key value) :: * # Methods lookup :: ContainerKey (HashMap key value) -> HashMap key value -> Maybe (MapValue (HashMap key value)) # insertMap :: ContainerKey (HashMap key value) -> MapValue (HashMap key value) -> HashMap key value -> HashMap key value # deleteMap :: ContainerKey (HashMap key value) -> HashMap key value -> HashMap key value # singletonMap :: ContainerKey (HashMap key value) -> MapValue (HashMap key value) -> HashMap key value # mapFromList :: [(ContainerKey (HashMap key value), MapValue (HashMap key value))] -> HashMap key value # mapToList :: HashMap key value -> [(ContainerKey (HashMap key value), MapValue (HashMap key value))] # findWithDefault :: MapValue (HashMap key value) -> ContainerKey (HashMap key value) -> HashMap key value -> MapValue (HashMap key value) # insertWith :: (MapValue (HashMap key value) -> MapValue (HashMap key value) -> MapValue (HashMap key value)) -> ContainerKey (HashMap key value) -> MapValue (HashMap key value) -> HashMap key value -> HashMap key value # insertWithKey :: (ContainerKey (HashMap key value) -> MapValue (HashMap key value) -> MapValue (HashMap key value) -> MapValue (HashMap key value)) -> ContainerKey (HashMap key value) -> MapValue (HashMap key value) -> HashMap key value -> HashMap key value # insertLookupWithKey :: (ContainerKey (HashMap key value) -> MapValue (HashMap key value) -> MapValue (HashMap key value) -> MapValue (HashMap key value)) -> ContainerKey (HashMap key value) -> MapValue (HashMap key value) -> HashMap key value -> (Maybe (MapValue (HashMap key value)), HashMap key value) # adjustMap :: (MapValue (HashMap key value) -> MapValue (HashMap key value)) -> ContainerKey (HashMap key value) -> HashMap key value -> HashMap key value # adjustWithKey :: (ContainerKey (HashMap key value) -> MapValue (HashMap key value) -> MapValue (HashMap key value)) -> ContainerKey (HashMap key value) -> HashMap key value -> HashMap key value # updateMap :: (MapValue (HashMap key value) -> Maybe (MapValue (HashMap key value))) -> ContainerKey (HashMap key value) -> HashMap key value -> HashMap key value # updateWithKey :: (ContainerKey (HashMap key value) -> MapValue (HashMap key value) -> Maybe (MapValue (HashMap key value))) -> ContainerKey (HashMap key value) -> HashMap key value -> HashMap key value # updateLookupWithKey :: (ContainerKey (HashMap key value) -> MapValue (HashMap key value) -> Maybe (MapValue (HashMap key value))) -> ContainerKey (HashMap key value) -> HashMap key value -> (Maybe (MapValue (HashMap key value)), HashMap key value) # alterMap :: (Maybe (MapValue (HashMap key value)) -> Maybe (MapValue (HashMap key value))) -> ContainerKey (HashMap key value) -> HashMap key value -> HashMap key value # unionWith :: (MapValue (HashMap key value) -> MapValue (HashMap key value) -> MapValue (HashMap key value)) -> HashMap key value -> HashMap key value -> HashMap key value # unionWithKey :: (ContainerKey (HashMap key value) -> MapValue (HashMap key value) -> MapValue (HashMap key value) -> MapValue (HashMap key value)) -> HashMap key value -> HashMap key value -> HashMap key value # unionsWith :: (MapValue (HashMap key value) -> MapValue (HashMap key value) -> MapValue (HashMap key value)) -> [HashMap key value] -> HashMap key value # mapWithKey :: (ContainerKey (HashMap key value) -> MapValue (HashMap key value) -> MapValue (HashMap key value)) -> HashMap key value -> HashMap key value # omapKeysWith :: (MapValue (HashMap key value) -> MapValue (HashMap key value) -> MapValue (HashMap key value)) -> (ContainerKey (HashMap key value) -> ContainerKey (HashMap key value)) -> HashMap key value -> HashMap key value #

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

Polymorphic typeclass for interacting with different set types

Minimal complete definition

insertSet, deleteSet, singletonSet, setFromList, setToList

Methods

insertSet :: Element set -> set -> set #

Insert a value into a set.

deleteSet :: Element set -> set -> set #

Delete a value from a set.

singletonSet :: Element set -> set #

Create a set from a single element.

setFromList :: [Element set] -> set #

Convert a list to a set.

setToList :: set -> [Element set] #

Convert a set to a list.

Instances

IsSet IntSet # |
Methods insertSet :: Element IntSet -> IntSet -> IntSet # deleteSet :: Element IntSet -> IntSet -> IntSet # singletonSet :: Element IntSet -> IntSet # setFromList :: [Element IntSet] -> IntSet # setToList :: IntSet -> [Element IntSet] #
Ord element => IsSet (Set element) # |
Methods insertSet :: Element (Set element) -> Set element -> Set element # deleteSet :: Element (Set element) -> Set element -> Set element # singletonSet :: Element (Set element) -> Set element # setFromList :: [Element (Set element)] -> Set element # setToList :: Set element -> [Element (Set element)] #
(Eq element, Hashable element) => IsSet (HashSet element) # |
Methods insertSet :: Element (HashSet element) -> HashSet element -> HashSet element # deleteSet :: Element (HashSet element) -> HashSet element -> HashSet element # singletonSet :: Element (HashSet element) -> HashSet element # setFromList :: [Element (HashSet element)] -> HashSet element # setToList :: HashSet element -> [Element (HashSet element)] #

class MonoFunctor mono => MonoZip mono where #

Zip operations on `MonoFunctor`s.

Minimal complete definition

ozipWith, ozip, ounzip

Methods

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

Combine each element of two `MonoZip`s using a supplied function.

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

Take two `MonoZip`s and return a list of the pairs of their elements.

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

Take a list of pairs of elements and return a `MonoZip` of the first components and a `MonoZip` of the second components.

Instances

MonoZip ByteString # |
Methods ozipWith :: (Element ByteString -> Element ByteString -> Element ByteString) -> ByteString -> ByteString -> ByteString # ozip :: ByteString -> ByteString -> [(Element ByteString, Element ByteString)] # ounzip :: [(Element ByteString, Element ByteString)] -> (ByteString, ByteString) #
MonoZip ByteString # |
Methods ozipWith :: (Element ByteString -> Element ByteString -> Element ByteString) -> ByteString -> ByteString -> ByteString # ozip :: ByteString -> ByteString -> [(Element ByteString, Element ByteString)] # ounzip :: [(Element ByteString, Element ByteString)] -> (ByteString, ByteString) #
MonoZip Text # |
Methods ozipWith :: (Element Text -> Element Text -> Element Text) -> Text -> Text -> Text # ozip :: Text -> Text -> [(Element Text, Element Text)] # ounzip :: [(Element Text, Element Text)] -> (Text, Text) #
MonoZip Text # |
Methods ozipWith :: (Element Text -> Element Text -> Element Text) -> Text -> Text -> Text # ozip :: Text -> Text -> [(Element Text, Element Text)] # ounzip :: [(Element Text, Element Text)] -> (Text, Text) #

class SetContainer set => HasKeysSet set where #

Type class for maps whose keys can be converted into sets.

Minimal complete definition

keysSet

Associated Types

type KeySet set #

Type of the key set.

Methods

keysSet :: set -> KeySet set #

Convert a map into a set of its keys.

Instances

HasKeysSet (IntMap v) # |
Associated Types type KeySet (IntMap v) :: * # Methods keysSet :: IntMap v -> KeySet (IntMap v) #
Ord k => HasKeysSet (Map k v) # |
Associated Types type KeySet (Map k v) :: * # Methods keysSet :: Map k v -> KeySet (Map k v) #
(Hashable k, Eq k) => HasKeysSet (HashMap k v) # |
Associated Types type KeySet (HashMap k v) :: * # Methods keysSet :: HashMap k v -> KeySet (HashMap k v) #