Safe Haskell | None |
---|---|

Language | Haskell98 |

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

- traversal :: Traversable t => Traversal (t a) (t b) a b
- iso :: (a -> b) -> (b -> a) -> Simple Iso a b
- iso' :: (a -> b) -> (a' -> b') -> (b -> a) -> (b' -> a') -> Iso a a' b b'
- lens :: (s -> a) -> (b -> s -> t) -> Lens s t a b
- partial :: (s -> Either t (a, b -> t)) -> Partial s t a b
- prism :: (a -> s) -> (b -> t) -> (s -> Either t a) -> (t -> Maybe b) -> Prism s t a b
- simplePrism :: (a -> s) -> (s -> Maybe a) -> Prism s s a a
- simplePartial :: (s -> Maybe (a, a -> s)) -> Partial s s a a
- fromLens :: (forall f. Functor f => (a -> f b) -> s -> f t) -> Lens s t a b
- fromTraversal :: (forall f. Applicative f => (a -> f b) -> s -> f t) -> Traversal s t a b
- uniplateRef :: Uniplate a => Simple Traversal a a
- biplateRef :: Biplate a b => Simple Traversal a b
- filtered :: (a -> Bool) -> Simple RefPlus a a

# 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

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