Abstraction over the modification of an element of a datastructure.
It is composable using the standard typeclasses, e.g.:
lookupAndDelete :: Monad m => Focus a m (Maybe a)
lookupAndDelete = lookup <* delete:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05
Modulefocus-1.0.3.2Haskell2010
Abstraction over the modification of an element of a datastructure.
It is composable using the standard typeclasses, e.g.:
lookupAndDelete :: Monad m => Focus a m (Maybe a)
lookupAndDelete = lookup <* deleteWhat to do with the focused value.
The interpretation of the commands is up to the context APIs.
Functor ChangeDefined in focus-1.0.3.2 · FocusEq a => Eq (Change a)Defined in focus-1.0.3.2 · FocusOrd a => Ord (Change a)Defined in focus-1.0.3.2 · FocusShow a => Show (Change a)Defined in focus-1.0.3.2 · FocusSemigroup (Change a)Defined in focus-1.0.3.2 · FocusMonoid (Change a)Defined in focus-1.0.3.2 · FocusReproduces the behaviour of
Data.Map.member.
Reproduces the behaviour of
Data.Map.lookup.
Reproduces the behaviour of
Data.Map.findWithDefault
with a better name.
Reproduces the behaviour of
Data.Map.delete.
Reproduces the behaviour of
Data.Map.insert.
Reproduces the behaviour of
Data.Map.insertWith
with a better name.
Reproduces the behaviour of
Data.Map.alter.
Reproduces the behaviour of
Data.Map.adjust.
Reproduces the behaviour of
Data.Map.update.
Lift a pure state monad.
Lift a pure state-monad-like function.
Lift pure functions which handle the cases of presence and absence of the element.
Lift pure functions which handle the cases of presence and absence of the element and produce no result.
A monadic version of lookupWithDefault.
A monadic version of insert.
A monadic version of insertOrMerge.
A monadic version of alter.
A monadic version of adjust.
A monadic version of update.
Lift monadic functions which handle the cases of presence and absence of the element.
Lift monadic functions which handle the cases of presence and absence of the element and produce no result.
Map the Focus input.
Extends the output with the input.
Extends the output with the change performed.
Extends the output with a projection on the change that was performed.
Extends the output with a flag, signaling whether a change, which is not Leave, has been introduced.
Extends the output with a flag, signaling whether the Remove change has been introduced.
Extends the output with a flag, signaling whether an item will be inserted. That is, it didn't exist before and a Set change is introduced.
testingSizeChange Extend the output with a flag, signaling how the size will be affected by the change.
Focus on the contents of a TVar.