focus-0.1.4: A general abstraction for manipulating elements of container data structures

Safe HaskellNone
LanguageHaskell2010

Focus

Contents

Synopsis

Documentation

type Strategy a r = Maybe a -> (r, Decision a) Source

A general modification function for some match. By processing a Maybe value it produces some value to emit and a Decision to perform on the match.

The interpretation of this function is up to the context APIs.

type StrategyM m a r = Maybe a -> m (r, Decision a) Source

A monadic version of Strategy.

data Decision a Source

What to do with the focused value.

The interpretation of the commands is up to the context APIs.

Constructors

Keep 
Remove 
Replace a 

Instances

Constructors for common pure patterns

adjust :: (a -> a) -> Strategy a () Source

Reproduces the behaviour of Data.Map.adjust.

update :: (a -> Maybe a) -> Strategy a () Source

Reproduces the behaviour of Data.Map.update.

alter :: (Maybe a -> Maybe a) -> Strategy a () Source

Reproduces the behaviour of Data.Map.alter.

insert :: a -> Strategy a () Source

Reproduces the behaviour of Data.Map.insert.

delete :: Strategy a () Source

Reproduces the behaviour of Data.Map.delete.

lookup :: Strategy a (Maybe a) Source

Reproduces the behaviour of Data.Map.lookup.

Constructors for monadic patterns

adjustM :: Monad m => (a -> m a) -> StrategyM m a () Source

A monadic version of adjust.

updateM :: Monad m => (a -> m (Maybe a)) -> StrategyM m a () Source

A monadic version of update.

alterM :: Monad m => (Maybe a -> m (Maybe a)) -> StrategyM m a () Source

A monadic version of alter.

insertM :: Monad m => a -> StrategyM m a () Source

A monadic version of insert.

deleteM :: Monad m => StrategyM m a () Source

A monadic version of delete.

lookupM :: Monad m => StrategyM m a (Maybe a) Source

A monadic version of lookup.