generic-lens-0.5.1.0: Generic data-structure operations exposed as lenses.

Copyright(C) 2017 Csongor Kiss
LicenseBSD3
MaintainerCsongor Kiss <kiss.csongor.kiss@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe
LanguageHaskell2010

Data.Generics.Internal.Lens

Description

Internal lens helpers. Only exported for Haddock

Synopsis

Documentation

type Lens' s a = Lens s s a a Source #

Type alias for lens

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

type Prism s t a b = forall p f. (Choice p, Applicative f) => p a (f b) -> p s (f t) Source #

Type alias for prism

type Prism' s a = Prism s s a a Source #

type Iso' s a = forall p f. (Profunctor p, Functor f) => p a (f a) -> p s (f s) Source #

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

(^.) :: s -> ((a -> Const a a) -> s -> Const a s) -> a infixl 8 Source #

Getting

set :: ((a -> Identity b) -> s -> Identity t) -> b -> s -> t Source #

Setting

(.~) :: ((a -> Identity b) -> s -> Identity t) -> b -> s -> t infixr 4 Source #

(^?) :: s -> ((a -> Const (First a) a) -> s -> Const (First a) s) -> Maybe a infixl 8 Source #

(#) :: (Tagged b (Identity b) -> Tagged t (Identity t)) -> b -> t infixr 8 Source #

first :: Lens ((a :*: b) x) ((a' :*: b) x) (a x) (a' x) Source #

Lens focusing on the first element of a product

second :: Lens ((a :*: b) x) ((a :*: b') x) (b x) (b' x) Source #

Lens focusing on the second element of a product

left :: Prism ((a :+: c) x) ((b :+: c) x) (a x) (b x) Source #

right :: Prism ((a :+: b) x) ((a :+: c) x) (b x) (c x) Source #

gsum :: (a x -> c) -> (b x -> c) -> (a :+: b) x -> c Source #

combine :: Lens' (s x) a -> Lens' (t x) a -> Lens' ((s :+: t) x) a Source #

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

repIso :: (Generic a, Generic b) => Iso a b (Rep a x) (Rep b x) Source #

A type and its generic representation are isomorphic

mIso :: Iso (M1 i c f p) (M1 i c g p) (f p) (g p) Source #

M1 is just a wrapper around `f p` mIso :: Iso' (M1 i c f p) (f p)

mLens :: Lens (M1 i c f p) (M1 i c g p) (f p) (g p) Source #

repLens :: (Generic a, Generic b) => Lens a b (Rep a x) (Rep b x) Source #

sumIso :: Iso' ((a :+: b) x) (Either (a x) (b x)) Source #

data Coyoneda f b Source #

Constructors

Coyoneda (a -> b) (f a) 

Instances

Functor (Coyoneda f) Source # 

Methods

fmap :: (a -> b) -> Coyoneda f a -> Coyoneda f b #

(<$) :: a -> Coyoneda f b -> Coyoneda f a #

inj :: Functor f => Coyoneda f a -> f a Source #

proj :: Functor f => f a -> Coyoneda f a Source #

ravel :: Functor f => ((a -> Coyoneda f b) -> s -> Coyoneda f t) -> (a -> f b) -> s -> f t Source #