Clean-0.6: A light, clean and powerful utility library

Safe HaskellNone

Clean.Lens

Contents

Description

A module providing simple Lens functionality

Synopsis

The lens types

type Iso s t a b = forall p f. (Functor f, Bifunctor p) => p s (f t) -> p a (f b)Source

type Iso' a b = Iso b b a aSource

data MkIso a b s t Source

Constructors

MkIso (s -> a) (b -> t) 

Instances

Bifunctor (MkIso a b) 
Cofunctor (Flip (MkIso a b) t) 
Functor (MkIso a b s) 

type LensLike f s t a b = (s -> f t) -> a -> f bSource

type LensLike' f a b = LensLike f b b a aSource

type Lens s t a b = forall f. Functor f => LensLike f s t a bSource

type Lens' a b = Lens b b a aSource

type Traversal s t a b = forall f. Applicative f => LensLike f s t a bSource

type Traversal' a b = Traversal b b a aSource

Constructing lenses

iso :: (a -> s) -> (t -> b) -> Iso s t a bSource

from :: MkIso t s b a -> Iso a b s tSource

lens :: (a -> s) -> (a -> t -> b) -> Lens s t a bSource

lam :: Functor f => (a -> s) -> LensLike f s t a aSource

prism :: (a -> b :+: s) -> (a -> t -> b) -> Traversal s t a bSource

Extracting values

(^.) :: a -> Lens' a b -> bSource

(%~) :: Traversal' a b -> (b -> b) -> a -> aSource

(.~) :: Traversal' a b -> b -> a -> aSource

Basic lenses

_1 :: Lens' (a :*: b) aSource

_2 :: Lens' (a :*: b) bSource

_both :: Traversal a b (a, a) (b, b)Source

_list :: Iso' [a] (() :+: (a :*: [a]))Source

class Wrapped s t a b | a -> s, b -> t, a t -> s, b s -> t whereSource

Methods

wrapped :: Iso s t a bSource

wrapping :: Wrapped b b a a => (a -> b) -> Iso' a bSource