lens-1.2: Lenses, Folds and Traversals

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

Data.IntMap.Lens

Description

 

Synopsis

Documentation

at :: Int -> Simple Lens (IntMap v) (Maybe v)Source

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

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

traverseAt :: Int -> Simple Traversal (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 :: Simple Traversal (IntMap v) vSource

Traverse the value at the minimum key in a Map

traverseAtMax :: Simple Traversal (IntMap v) vSource

Traverse the value at the maximum key in a Map