Data.Generics.Sum.Internal.Constructors

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.Generics.Sum.Internal.Constructors

Description

Derive constructor-name-based prisms generically.

Synopsis

- class GAsConstructor (ctor :: Symbol) (s :: Type -> Type) (t :: Type -> Type) a b | ctor s -> a, ctor t -> b where
  - _GCtor :: Prism (s x) (t x) a b
- type GAsConstructor' (ctor :: Symbol) (s :: Type -> Type) a = GAsConstructor ctor s s a a
- type Context' (ctor :: Symbol) s a = (Context0 ctor s s a a, ErrorUnless ctor s (HasCtorP ctor (Rep s)))
- class Context (ctor :: Symbol) s t a b | ctor s -> a, ctor t -> b
- class Context_ (ctor :: Symbol) s t a b
- type Context0 (ctor :: Symbol) s t a b = (Generic s, Generic t, GAsConstructor ctor (Rep s) (Rep t) a b, Defined (Rep s) (NoGeneric s '[(('Text "arising from a generic prism focusing on the " ':<>: QuoteType ctor) ':<>: 'Text " constructor of type ") ':<>: QuoteType a, 'Text "in " ':<>: QuoteType s]) ())
- derived0 :: forall (ctor :: Symbol) s t a b. Context0 ctor s t a b => Prism s t a b

# Documentation

class GAsConstructor (ctor :: Symbol) (s :: Type -> Type) (t :: Type -> Type) a b | ctor s -> a, ctor t -> b where #

As `AsConstructor` but over generic representations as defined by GHC.Generics.

Methods

_GCtor :: Prism (s x) (t x) a b #

#### Instances

Instances details

GSumAsConstructor ctor (HasCtorP ctor l) l r l' r' a b => GAsConstructor ctor (l :+: r) (l' :+: r') a b # |
Instance details Defined in Data.Generics.Sum.Internal.Constructors Methods _GCtor :: Prism ((l :+: r) x) ((l' :+: r') x) a b #
(GIsList f g as bs, ListTuple a b as bs) => GAsConstructor ctor (M1 C ('MetaCons ctor fixity fields) f) (M1 C ('MetaCons ctor fixity fields) g) a b # |
Instance details Defined in Data.Generics.Sum.Internal.Constructors Methods _GCtor :: Prism (M1 C ('MetaCons ctor fixity fields) f x) (M1 C ('MetaCons ctor fixity fields) g x) a b #
GAsConstructor ctor f f' a b => GAsConstructor ctor (M1 D meta f) (M1 D meta f') a b # |
Instance details Defined in Data.Generics.Sum.Internal.Constructors Methods _GCtor :: Prism (M1 D meta f x) (M1 D meta f' x) a b #

type GAsConstructor' (ctor :: Symbol) (s :: Type -> Type) a = GAsConstructor ctor s s a a #

type Context' (ctor :: Symbol) s a = (Context0 ctor s s a a, ErrorUnless ctor s (HasCtorP ctor (Rep s))) #

class Context (ctor :: Symbol) s t a b | ctor s -> a, ctor t -> b #

#### Instances

Instances details

(ErrorUnless ctor s (HasCtorP ctor (Rep s)), GAsConstructor' ctor (Rep s) a, GAsConstructor' ctor (Rep (Indexed s)) a', GAsConstructor ctor (Rep s) (Rep t) a b, t ~ Infer s a' b, GAsConstructor' ctor (Rep (Indexed t)) b', s ~ Infer t b' a) => Context ctor s t a b # |
Instance details Defined in Data.Generics.Sum.Internal.Constructors

class Context_ (ctor :: Symbol) s t a b #

#### Instances

Instances details

(ErrorUnless ctor s (HasCtorP ctor (Rep s)), GAsConstructor' ctor (Rep s) a, GAsConstructor' ctor (Rep (Indexed s)) a', GAsConstructor ctor (Rep s) (Rep t) a b, GAsConstructor' ctor (Rep (Indexed t)) b', UnifyHead s t, UnifyHead t s) => Context_ ctor s t a b # |
Instance details Defined in Data.Generics.Sum.Internal.Constructors

type Context0 (ctor :: Symbol) s t a b = (Generic s, Generic t, GAsConstructor ctor (Rep s) (Rep t) a b, Defined (Rep s) (NoGeneric s '[(('Text "arising from a generic prism focusing on the " ':<>: QuoteType ctor) ':<>: 'Text " constructor of type ") ':<>: QuoteType a, 'Text "in " ':<>: QuoteType s]) ()) #

derived0 :: forall (ctor :: Symbol) s t a b. Context0 ctor s t a b => Prism s t a b #