generic-lens-2.2.2.0: Generically derive traversals, lenses and prisms.

Safe Haskell | None
Language | Haskell2010

Data.Generics.Internal.VL

Synopsis

- type Lens s t a b = forall (f :: Type -> Type). Functor f => (a -> f b) -> s -> f t
- ravel :: (ALens a b i a b -> ALens a b i s t) -> Lens s t a b
- set :: Lens s t a b -> b -> s -> t
- view :: ((a -> Const a a) -> s -> Const a s) -> s -> a
- lens :: (s -> a) -> (s -> b -> t) -> Lens s t a b
- type Lens' s a = Lens s s a a
- (^.) :: s -> ((a -> Const a a) -> s -> Const a s) -> a
- (.~) :: ((a -> Identity b) -> s -> Identity t) -> b -> s -> t
- over :: ((a -> Identity b) -> s -> Identity t) -> (a -> b) -> s -> t
- lens2lensvl :: ALens a b i s t -> Lens s t a b
- type Iso' s a = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Profunctor p, Functor f) => p a (f a) -> p s (f s)
- type Iso s t a b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Profunctor p, Functor f) => p a (f b) -> p s (f t)
- repIso :: (Generic a, Generic b) => Iso a b (Rep a x) (Rep b x)
- mIso :: forall {k} i (c :: Meta) f1 (p1 :: k) g p2 f2. (Profunctor p2, Functor f2) => p2 (f1 p1) (f2 (g p1)) -> p2 (M1 i c f1 p1) (f2 (M1 i c g p1))
- kIso :: forall {k} r a (p1 :: k) b p2 f. (Profunctor p2, Functor f) => p2 a (f b) -> p2 (K1 r a p1) (f (K1 r b p1))
- recIso :: forall {k} r a (p1 :: k) b p2 f. (Profunctor p2, Functor f) => p2 a (f b) -> p2 (Rec r a p1) (f (Rec r b p1))
- prodIso :: forall {k} a b (x :: k) a' b' p f. (Profunctor p, Functor f) => p (a x, b x) (f (a' x, b' x)) -> p ((a :*: b) x) (f ((a' :*: b') x))
- fromIso :: Iso s t a b -> Iso b a t s
- iso :: (s -> a) -> (b -> t) -> Iso s t a b
- withIso :: Iso s t a b -> ((s -> a) -> (b -> t) -> r) -> r
- iso2isovl :: Iso s t a b -> Iso s t a b
- data Exchange a b s t = Exchange (s -> a) (b -> t)
- repIsoN :: (GenericN a, GenericN b) => Iso a b (RepN a x) (RepN b x)
- paramIso :: forall (n :: Nat) a b p f. (Profunctor p, Functor f) => p a (f b) -> p (Param n a) (f (Param n b))
- build :: Prism s t a b -> b -> t
- match :: Prism s t a b -> s -> Either t a
- type Prism' s a = Prism s s a a
- type Prism s t a b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Choice p, Applicative f) => p a (f b) -> p s (f t)
- prism :: (b -> t) -> (s -> Either t a) -> Prism s t a b
- data Market a b s t = Market (b -> t) (s -> Either t a)
- prism2prismvl :: APrism i s t a b -> Prism s t a b
- type Traversal' s a = forall (f :: Type -> Type). Applicative f => (a -> f a) -> s -> f s
- confusing :: Applicative f => Traversal s t a b -> (a -> f b) -> s -> f t
- liftCurried :: Applicative f => f a -> Curried f a
- liftCurriedYoneda :: Applicative f => f a -> Curried (Yoneda f) a
- liftYoneda :: Functor f => f a -> Yoneda f a
- lowerCurried :: Applicative f => Curried f a -> f a
- lowerYoneda :: Yoneda f a -> f a
- yap :: Applicative f => Yoneda f (a -> b) -> f a -> Yoneda f b
- newtype Curried (f :: Type -> Type) a = Curried {
  - runCurried :: forall r. f (a -> r) -> f r
  }
- type Traversal s t a b = forall (f :: Type -> Type). Applicative f => (a -> f b) -> s -> f t
- newtype Yoneda (f :: Type -> Type) a = Yoneda {
  - runYoneda :: forall b. (a -> b) -> f b
  }

# Documentation

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

ravel :: (ALens a b i a b -> ALens a b i s t) -> Lens s t a b Source #

set :: Lens s t a b -> b -> s -> t Source #

view :: ((a -> Const a a) -> s -> Const a s) -> s -> a Source #

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

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

Type alias for lens

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

Getting

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

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

lens2lensvl :: ALens a b i s t -> Lens s t a b Source #

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

type Iso s t a b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Profunctor p, Functor f) => p a (f b) -> p s (f t) 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 :: forall {k} i (c :: Meta) f1 (p1 :: k) g p2 f2. (Profunctor p2, Functor f2) => p2 (f1 p1) (f2 (g p1)) -> p2 (M1 i c f1 p1) (f2 (M1 i c g p1)) Source #

`M1` is just a wrapper around `f p`

kIso :: forall {k} r a (p1 :: k) b p2 f. (Profunctor p2, Functor f) => p2 a (f b) -> p2 (K1 r a p1) (f (K1 r b p1)) Source #

recIso :: forall {k} r a (p1 :: k) b p2 f. (Profunctor p2, Functor f) => p2 a (f b) -> p2 (Rec r a p1) (f (Rec r b p1)) Source #

prodIso :: forall {k} a b (x :: k) a' b' p f. (Profunctor p, Functor f) => p (a x, b x) (f (a' x, b' x)) -> p ((a :*: b) x) (f ((a' :*: b') x)) Source #

fromIso :: Iso s t a b -> Iso b a t s Source #

iso :: (s -> a) -> (b -> t) -> Iso s t a b Source #

withIso :: Iso s t a b -> ((s -> a) -> (b -> t) -> r) -> r Source #

Extract the two functions, one from `s -> a` and one from `b -> t` that characterize an `Iso`.

iso2isovl :: Iso s t a b -> Iso s t a b Source #

data Exchange a b s t Source #

Constructors

Exchange (s -> a) (b -> t) |

#### Instances

Instances details

Profunctor (Exchange a b) Source # |

Instance details

Defined in Data.Generics.Internal.VL.Iso

Methods

dimap :: (a0 -> b0) -> (c -> d) -> Exchange a b b0 c -> Exchange a b a0 d Source #

lmap :: (a0 -> b0) -> Exchange a b b0 c -> Exchange a b a0 c Source #

rmap :: (b0 -> c) -> Exchange a b a0 b0 -> Exchange a b a0 c Source #

(#.) :: forall a0 b0 c q. Coercible c b0 => q b0 c -> Exchange a b a0 b0 -> Exchange a b a0 c Source #

(.#) :: forall a0 b0 c q. Coercible b0 a0 => Exchange a b b0 c -> q a0 b0 -> Exchange a b a0 c Source #

Functor (Exchange a b s) Source # |
Instance details Defined in Data.Generics.Internal.VL.Iso Methods fmap :: (a0 -> b0) -> Exchange a b s a0 -> Exchange a b s b0 Source # (<$) :: a0 -> Exchange a b s b0 -> Exchange a b s a0 Source #

repIsoN :: (GenericN a, GenericN b) => Iso a b (RepN a x) (RepN b x) Source #

paramIso :: forall (n :: Nat) a b p f. (Profunctor p, Functor f) => p a (f b) -> p (Param n a) (f (Param n b)) Source #

build :: Prism s t a b -> b -> t Source #

match :: Prism s t a b -> s -> Either t a Source #

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

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

Type alias for prism

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

data Market a b s t Source #

Constructors

Market (b -> t) (s -> Either t a) |

#### Instances

Instances details

Choice (Market a b) Source # |
Instance details Defined in Data.Generics.Internal.VL.Prism Methods left' :: Market a b a0 b0 -> Market a b (Either a0 c) (Either b0 c) Source # right' :: Market a b a0 b0 -> Market a b (Either c a0) (Either c b0) Source #
Profunctor (Market a b) Source # |

Instance details

Defined in Data.Generics.Internal.VL.Prism

Methods

dimap :: (a0 -> b0) -> (c -> d) -> Market a b b0 c -> Market a b a0 d Source #

lmap :: (a0 -> b0) -> Market a b b0 c -> Market a b a0 c Source #

rmap :: (b0 -> c) -> Market a b a0 b0 -> Market a b a0 c Source #

(#.) :: forall a0 b0 c q. Coercible c b0 => q b0 c -> Market a b a0 b0 -> Market a b a0 c Source #

(.#) :: forall a0 b0 c q. Coercible b0 a0 => Market a b b0 c -> q a0 b0 -> Market a b a0 c Source #

Functor (Market a b s) Source # |
Instance details Defined in Data.Generics.Internal.VL.Prism Methods fmap :: (a0 -> b0) -> Market a b s a0 -> Market a b s b0 Source # (<$) :: a0 -> Market a b s b0 -> Market a b s a0 Source #

prism2prismvl :: APrism i s t a b -> Prism s t a b Source #

type Traversal' s a = forall (f :: Type -> Type). Applicative f => (a -> f a) -> s -> f s Source #

Type alias for traversal

confusing :: Applicative f => Traversal s t a b -> (a -> f b) -> s -> f t Source #

liftCurried :: Applicative f => f a -> Curried f a Source #

liftCurriedYoneda :: Applicative f => f a -> Curried (Yoneda f) a Source #

liftYoneda :: Functor f => f a -> Yoneda f a Source #

lowerCurried :: Applicative f => Curried f a -> f a Source #

lowerYoneda :: Yoneda f a -> f a Source #

yap :: Applicative f => Yoneda f (a -> b) -> f a -> Yoneda f b Source #

newtype Curried (f :: Type -> Type) a Source #

Constructors

Curried |

Fields

- runCurried :: forall r. f (a -> r) -> f r

#### Instances

Instances details

Functor f => Applicative (Curried f) |
Instance details Defined in Data.Generics.Internal.VL.Traversal Methods pure :: a -> Curried f a Source # (<*>) :: Curried f (a -> b) -> Curried f a -> Curried f b Source # liftA2 :: (a -> b -> c) -> Curried f a -> Curried f b -> Curried f c Source # (*>) :: Curried f a -> Curried f b -> Curried f b Source # (<*) :: Curried f a -> Curried f b -> Curried f a Source #
Functor f => Functor (Curried f) |
Instance details Defined in Data.Generics.Internal.VL.Traversal Methods fmap :: (a -> b) -> Curried f a -> Curried f b Source # (<$) :: a -> Curried f b -> Curried f a Source #

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

newtype Yoneda (f :: Type -> Type) a Source #

Constructors

Yoneda |

Fields

- runYoneda :: forall b. (a -> b) -> f b

#### Instances

Instances details

Applicative f => Applicative (Yoneda f) |
Instance details Defined in Data.Generics.Internal.VL.Traversal Methods pure :: a -> Yoneda f a Source # (<*>) :: Yoneda f (a -> b) -> Yoneda f a -> Yoneda f b Source # liftA2 :: (a -> b -> c) -> Yoneda f a -> Yoneda f b -> Yoneda f c Source # (*>) :: Yoneda f a -> Yoneda f b -> Yoneda f b Source # (<*) :: Yoneda f a -> Yoneda f b -> Yoneda f a Source #
Functor (Yoneda f) |
Instance details Defined in Data.Generics.Internal.VL.Traversal Methods fmap :: (a -> b) -> Yoneda f a -> Yoneda f b Source # (<$) :: a -> Yoneda f b -> Yoneda f a Source #