Module

Data.Lens.At

#At

class (Index m a b) <= At m a b | m -> a, m -> b where

At is a type class whose instances let you add new elements or delete old ones from "container-like" types:

whole = Map.singleton "key" "value"
optic = at "key"

view optic whole == Just "value"

set optic (Just "NEW") whole == Map.singleton "key" "NEW"

set optic Nothing whole == Map.empty

If you don't want to add or delete, but only to view or change an existing element, see Data.Lens.Index.

Members

Instances

Modules