lens-2.0: Lenses, Folds and Traversals

PortabilityRank2Types
Stabilityprovisional
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellSafe-Infered

Data.IntMap.Lens

Description

 

Synopsis

Documentation

at :: Int -> SimpleIndexedLens Int (IntMap v) (Maybe v)Source

This Lens can be used to read, write or delete the value associated with a key in an IntMap.

>>> fromList [(1,"hello")] ^.at 1
Just "hello"
>>> at 1 .~ Just "hello" $ IntMap.empty
fromList [(1,"hello")]
 at :: Int -> (Maybe v -> f (Maybe v)) -> IntMap v -> f (IntMap v)

traverseIntMap :: IndexedTraversal Int (IntMap v) (IntMap v') v v'Source

Traversal of an IntMap indexed by the key.

traverseAt :: Int -> SimpleIndexedTraversal Int (IntMap v) vSource

Traverse the value at a given key in an IntMap

 traverseAt :: Applicative f => Int -> (v -> f v) -> IntMap v -> f (IntMap v)
 traverseAt k = at k . traverse

traverseAtMin :: SimpleIndexedTraversal Int (IntMap v) vSource

Traverse the value at the minimum key in a Map

The key of the minimum element is available as the index.

traverseAtMax :: SimpleIndexedTraversal Int (IntMap v) vSource

Traverse the value at the maximum key in a Map