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

Copyright | (C) 2020 Csongor Kiss
License | BSD3
Maintainer | Csongor Kiss <kiss.csongor.kiss@gmail.com>
Stability | experimental
Portability | non-portable
Safe Haskell | None
Language | Haskell2010

Data.GenericLens.Internal

Contents

- Profunctor optics

Description

The library internals are exposed through this module. Please keep in mind that everything here is subject to change irrespective of the the version numbers.

Synopsis

- module Data.Generics.Internal.Families
- module Data.Generics.Internal.Families.Changing
- module Data.Generics.Internal.Families.Collect
- module Data.Generics.Internal.Families.Has
- module Data.Generics.Internal.Void
- module Data.Generics.Internal.Errors
- data family Param :: Nat -> j -> k
- class (Coercible (Rep a) (RepN a), Generic a) => GenericN a where
  - type RepN a :: Type -> Type
  - toN :: RepN a x -> a
  - fromN :: a -> RepN a x
- newtype Rec p a (x :: k) = Rec {
  - unRec :: K1 R a x
  }
- type family RepN a :: Type -> Type
- type Iso s t a b = forall (p :: Type -> Type -> Type -> Type) i. Profunctor p => p i a b -> p i s t
- repIso :: (Generic a, Generic b) => Iso a b (Rep a x) (Rep b x)
- kIso :: forall r a p1 b p2 i. Profunctor p2 => p2 i a b -> p2 i (K1 r a p1) (K1 r b p1)
- sumIso :: forall a b x a' b' p i. Profunctor p => p i (Either (a x) (b x)) (Either (a' x) (b' x)) -> p i ((a :+: b) x) ((a' :+: b') x)
- mIso :: forall i1 (c :: Meta) f p1 g p2 i2. Profunctor p2 => p2 i2 (f p1) (g p1) -> p2 i2 (M1 i1 c f p1) (M1 i1 c g p1)
- type Iso' s a = Iso s s a a
- iso :: (s -> a) -> (b -> t) -> Iso s t a b
- recIso :: forall r a p1 b p2 i. Profunctor p2 => p2 i a b -> p2 i (Rec r a p1) (Rec r b p1)
- prodIso :: forall a b x a' b' p i. Profunctor p => p i (a x, b x) (a' x, b' x) -> p i ((a :*: b) x) ((a' :*: b') x)
- assoc3 :: forall a b c a' b' c' p i. Profunctor p => p i (a, (b, c)) (a', (b', c')) -> p i ((a, b), c) ((a', b'), c')
- fromIso :: Iso s t a b -> Iso b a t s
- withIso :: Iso s t a b -> ((s -> a) -> (b -> t) -> r) -> r
- pairing :: Iso s t a b -> Iso s' t' a' b' -> Iso (s, s') (t, t') (a, a') (b, b')
- first :: forall a (b :: Type -> Type) x a' p i. Strong p => p i (a x) (a' x) -> p i ((a :*: b) x) ((a' :*: b) x)
- swap :: (a, b) -> (b, a)
- second :: forall (a :: Type -> Type) b x b' p i. Strong p => p i (b x) (b' x) -> p i ((a :*: b) x) ((a :*: b') x)
- type Lens s t a b = forall (p :: Type -> Type -> Type -> Type) i. Strong p => p i a b -> p i s t
- choosing :: Lens s t a b -> Lens s' t' a b -> Lens (Either s s') (Either t t') a b
- view :: Lens s s a a -> s -> a
- set :: ((a -> b) -> s -> t) -> (s, b) -> t
- type LensLike (p :: Type -> Type -> Type) s t a b = p a b -> p s t
- ravel :: (ALens a b i a b -> ALens a b i s t) -> Lens s t a b
- data ALens a b i s t = ALens (s -> (c, a)) ((c, b) -> t)
- idLens :: ALens a b i a b
- lens :: (s -> (c, a)) -> ((c, b) -> t) -> Lens s t a b
- withLensPrim :: Lens s t a b -> (forall c. (s -> (c, a)) -> ((c, b) -> t) -> r) -> r
- fork :: (a -> b) -> (a -> c) -> a -> (b, c)
- data Coyoneda (f :: Type -> Type) b = Coyoneda (a -> b) (f a)
- inj :: Functor f => Coyoneda f a -> f a
- proj :: Functor f => f a -> Coyoneda f a
- (??) :: Functor f => f (a -> b) -> a -> f b
- assoc3L :: forall a b c a' b' c' p i. Strong p => p i (a, (b, c)) (a', (b', c')) -> p i ((a, b), c) ((a', b'), c')
- stron :: (Either s s', b) -> Either (s, b) (s', b)
- build :: (Tagged i b b -> Tagged i t t) -> b -> t
- left :: forall a (c :: Type -> Type) x b p i. Choice p => p i (a x) (b x) -> p i ((a :+: c) x) ((b :+: c) x)
- right :: forall (a :: Type -> Type) b x c p i. Choice p => p i (b x) (c x) -> p i ((a :+: b) x) ((a :+: c) x)
- match :: Prism s t a b -> s -> Either t a
- type APrism i s t a b = Market a b i a b -> Market a b i s t
- type Prism s t a b = forall (p :: Type -> Type -> Type -> Type) i. Choice p => p i a b -> p i s t
- type Prism' s a = forall (p :: Type -> Type -> Type -> Type) i. Choice p => p i a a -> p i s s
- prism :: (b -> t) -> (s -> Either t a) -> Prism s t a b
- gsum :: (a x -> c) -> (b x -> c) -> (a :+: b) x -> c
- _Left :: forall a c b p i. Choice p => p i a b -> p i (Either a c) (Either b c)
- _Right :: forall c a b p i. Choice p => p i a b -> p i (Either c a) (Either c b)
- prismPRavel :: APrism i s t a b -> Prism s t a b
- prism2prismp :: Market a b i s t -> Prism s t a b
- idPrism :: Market a b i a b
- withPrism :: APrism i s t a b -> ((b -> t) -> (s -> Either t a) -> r) -> r
- without' :: Prism s t a b -> Prism s t c d -> Prism s t (Either a c) (Either b d)
- module Data.Generics.Product.Internal.Subtype

# Documentation

module Data.Generics.Internal.Families

module Data.Generics.Internal.Families.Changing

module Data.Generics.Internal.Families.Collect

module Data.Generics.Internal.Families.Has

module Data.Generics.Internal.Void

module Data.Generics.Internal.Errors

data family Param :: Nat -> j -> k Source #

#### Instances

Instances details

newtype Param n (a :: Type) Source # |

Instance details

Defined in Data.Generics.Internal.GenericN

newtype Param n (a :: Type) = StarParam {

- getStarParam :: a

}

class (Coercible (Rep a) (RepN a), Generic a) => GenericN a where Source #

Associated Types

type RepN a :: Type -> Type Source #

type RepN a = Rep (Indexed a 0)

Methods

toN :: RepN a x -> a Source #

fromN :: a -> RepN a x Source #

#### Instances

Instances details

(Coercible (Rep a) (RepN a), Generic a) => GenericN a Source # |

Instance details

Defined in Data.Generics.Internal.GenericN

Associated Types

type RepN a |
Instance details Defined in Data.Generics.Internal.GenericN type RepN a

Methods

toN :: RepN a x -> a Source #

fromN :: a -> RepN a x Source #

newtype Rec p a (x :: k) Source #

Constructors

Rec |

Fields

- unRec :: K1 R a x

type family RepN a :: Type -> Type Source #

#### Instances

Instances details

type RepN a Source # |
Instance details Defined in Data.Generics.Internal.GenericN type RepN a

# Profunctor optics

type Iso s t a b = forall (p :: Type -> Type -> Type -> Type) i. Profunctor p => p i a b -> p i s 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

kIso :: forall r a p1 b p2 i. Profunctor p2 => p2 i a b -> p2 i (K1 r a p1) (K1 r b p1) Source #

sumIso :: forall a b x a' b' p i. Profunctor p => p i (Either (a x) (b x)) (Either (a' x) (b' x)) -> p i ((a :+: b) x) ((a' :+: b') x) Source #

mIso :: forall i1 (c :: Meta) f p1 g p2 i2. Profunctor p2 => p2 i2 (f p1) (g p1) -> p2 i2 (M1 i1 c f p1) (M1 i1 c g p1) Source #

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

type Iso' s a = Iso s s a a Source #

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

recIso :: forall r a p1 b p2 i. Profunctor p2 => p2 i a b -> p2 i (Rec r a p1) (Rec r b p1) Source #

prodIso :: forall a b x a' b' p i. Profunctor p => p i (a x, b x) (a' x, b' x) -> p i ((a :*: b) x) ((a' :*: b') x) Source #

assoc3 :: forall a b c a' b' c' p i. Profunctor p => p i (a, (b, c)) (a', (b', c')) -> p i ((a, b), c) ((a', b'), c') Source #

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

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

pairing :: Iso s t a b -> Iso s' t' a' b' -> Iso (s, s') (t, t') (a, a') (b, b') Source #

first :: forall a (b :: Type -> Type) x a' p i. Strong p => p i (a x) (a' x) -> p i ((a :*: b) x) ((a' :*: b) x) Source #

Lens focusing on the first element of a product

swap :: (a, b) -> (b, a) Source #

second :: forall (a :: Type -> Type) b x b' p i. Strong p => p i (b x) (b' x) -> p i ((a :*: b) x) ((a :*: b') x) Source #

Lens focusing on the second element of a product

type Lens s t a b = forall (p :: Type -> Type -> Type -> Type) i. Strong p => p i a b -> p i s t Source #

choosing :: Lens s t a b -> Lens s' t' a b -> Lens (Either s s') (Either t t') a b Source #

view :: Lens s s a a -> s -> a Source #

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

Setting

type LensLike (p :: Type -> Type -> Type) s t a b = p a b -> p s t Source #

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

data ALens a b i s t Source #

Constructors

ALens (s -> (c, a)) ((c, b) -> t) |

#### Instances

Instances details

Profunctor (ALens a b) Source # |

Instance details

Defined in Data.Generics.Internal.Profunctor.Lens

Methods

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

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

rmap :: (c -> d) -> ALens a b i b0 c -> ALens a b i b0 d Source #

lcoerce' :: Coercible a0 b0 => ALens a b i a0 c -> ALens a b i b0 c Source #

rcoerce' :: Coercible a0 b0 => ALens a b i c a0 -> ALens a b i c b0 Source #

conjoined__ :: (ALens a b i a0 b0 -> ALens a b i s t) -> (ALens a b i a0 b0 -> ALens a b j s t) -> ALens a b i a0 b0 -> ALens a b j s t Source #

ixcontramap :: (j -> i) -> ALens a b i a0 b0 -> ALens a b j a0 b0 Source #

Strong (ALens a b) Source # |

Instance details

Defined in Data.Generics.Internal.Profunctor.Lens

Methods

first' :: ALens a b i a0 b0 -> ALens a b i (a0, c) (b0, c) Source #

second' :: ALens a b i a0 b0 -> ALens a b i (c, a0) (c, b0) Source #

linear :: (forall (f :: Type -> Type). Functor f => (a0 -> f b0) -> s -> f t) -> ALens a b i a0 b0 -> ALens a b i s t Source #

ilinear :: (forall (f :: Type -> Type). Functor f => (i -> a0 -> f b0) -> s -> f t) -> ALens a b j a0 b0 -> ALens a b (i -> j) s t Source #

Functor (ALens a b i s) Source # |
Instance details Defined in Data.Generics.Internal.Profunctor.Lens Methods fmap :: (a0 -> b0) -> ALens a b i s a0 -> ALens a b i s b0 Source # (<$) :: a0 -> ALens a b i s b0 -> ALens a b i s a0 Source #

idLens :: ALens a b i a b Source #

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

withLensPrim :: Lens s t a b -> (forall c. (s -> (c, a)) -> ((c, b) -> t) -> r) -> r Source #

fork :: (a -> b) -> (a -> c) -> a -> (b, c) Source #

data Coyoneda (f :: Type -> Type) b Source #

Constructors

Coyoneda (a -> b) (f a) |

#### Instances

Instances details

Functor (Coyoneda f) Source # |
Instance details Defined in Data.Generics.Internal.Profunctor.Lens Methods fmap :: (a -> b) -> Coyoneda f a -> Coyoneda f b Source # (<$) :: a -> Coyoneda f b -> Coyoneda f a Source #

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

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

(??) :: Functor f => f (a -> b) -> a -> f b Source #

assoc3L :: forall a b c a' b' c' p i. Strong p => p i (a, (b, c)) (a', (b', c')) -> p i ((a, b), c) ((a', b'), c') Source #

stron :: (Either s s', b) -> Either (s, b) (s', b) Source #

build :: (Tagged i b b -> Tagged i t t) -> b -> t Source #

left :: forall a (c :: Type -> Type) x b p i. Choice p => p i (a x) (b x) -> p i ((a :+: c) x) ((b :+: c) x) Source #

right :: forall (a :: Type -> Type) b x c p i. Choice p => p i (b x) (c x) -> p i ((a :+: b) x) ((a :+: c) x) Source #

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

type APrism i s t a b = Market a b i a b -> Market a b i s t Source #

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

type Prism' s a = forall (p :: Type -> Type -> Type -> Type) i. Choice p => p i a a -> p i s s Source #

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

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

_Left :: forall a c b p i. Choice p => p i a b -> p i (Either a c) (Either b c) Source #

_Right :: forall c a b p i. Choice p => p i a b -> p i (Either c a) (Either c b) Source #

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

prism2prismp :: Market a b i s t -> Prism s t a b Source #

idPrism :: Market a b i a b Source #

withPrism :: APrism i s t a b -> ((b -> t) -> (s -> Either t a) -> r) -> r Source #

without' :: Prism s t a b -> Prism s t c d -> Prism s t (Either a c) (Either b d) Source #

module Data.Generics.Product.Internal.Subtype