references-0.3.2.1: Selectors for reading and updating data.

Safe HaskellNone
LanguageHaskell98

Control.Reference.Generators

Description

Functions to create references from simple functions and members of the lens library.

Synopsis

Documentation

traversal :: Traversable t => Traversal (t a) (t b) a b Source #

Generates a traversal for any Traversable Functor

iso :: (a -> b) -> (b -> a) -> Simple Iso a b Source #

Generate a lens from a pair of inverse functions

iso' :: (a -> b) -> (a' -> b') -> (b -> a) -> (b' -> a') -> Iso a a' b b' Source #

lens :: (s -> a) -> (b -> s -> t) -> Lens s t a b Source #

Generates a lens from a getter and a setter

partial :: (s -> Either t (a, b -> t)) -> Partial s t a b Source #

Creates a polymorphic partial lense

Either t a is used instead of Maybe a to permit the types of s and t to differ.

prism :: (a -> s) -> (b -> t) -> (s -> Either t a) -> (t -> Maybe b) -> Prism s t a b Source #

Creates a polymorphic partial lens that can be turned to give a total lens

simplePrism :: (a -> s) -> (s -> Maybe a) -> Prism s s a a Source #

Creates a monomorphic partial lens that can be turned to give a total lens

simplePartial :: (s -> Maybe (a, a -> s)) -> Partial s s a a Source #

Creates a simple partial lens

fromLens :: (forall f. Functor f => (a -> f b) -> s -> f t) -> Lens s t a b Source #

Clones a lens from Control.Lens

fromTraversal :: (forall f. Applicative f => (a -> f b) -> s -> f t) -> Traversal s t a b Source #

Clones a traversal from Control.Lens

uniplateRef :: Uniplate a => Simple Traversal a a Source #

References all the elements accessed by uniplate

biplateRef :: Biplate a b => Simple Traversal a b Source #

References all the elements accessed by biplate

filtered :: (a -> Bool) -> Simple RefPlus a a Source #

Filters the traversed elements with a given predicate. Has specific versions for traversals and partial lenses.