optics-core-0.4.1.1: Optics as an abstract interface: core definitions

Safe Haskell | None
Language | Haskell2010

GHC.Generics.Optics

Description

Note: GHC.Generics exports a number of names that collide with Optics (at least `to`).

You can use hiding of imports to mitigate this to an extent. The following imports represent a fair compromise for user code:

    import Optics
    import GHC.Generics hiding (to)
    import GHC.Generics.Optics

You can use `generic` to replace `from` and `to` from GHC.Generics.

Synopsis

- generic :: (Generic a, Generic b) => Iso a b (Rep a x) (Rep b y)
- generic1 :: (Generic1 f, Generic1 g) => Iso (f x) (g y) (Rep1 f x) (Rep1 g y)
- _V1 :: Lens (V1 s) (V1 t) a b
- _U1 :: Iso (U1 p) (U1 q) () ()
- _Par1 :: Iso (Par1 p) (Par1 q) p q
- _Rec1 :: Iso (Rec1 f p) (Rec1 g q) (f p) (g q)
- _K1 :: Iso (K1 i c p) (K1 j d q) c d
- _M1 :: forall i (c :: Meta) f p j (d :: Meta) g q. Iso (M1 i c f p) (M1 j d g q) (f p) (g q)
- _L1 :: forall a (c :: Type -> Type) t b. Prism ((a :+: c) t) ((b :+: c) t) (a t) (b t)
- _R1 :: forall (c :: Type -> Type) a t b. Prism ((c :+: a) t) ((c :+: b) t) (a t) (b t)

# Documentation

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

Convert from the data type to its representation (or back)

    >>> view (generic % re generic) "hello" :: String
    "hello"

generic1 :: (Generic1 f, Generic1 g) => Iso (f x) (g y) (Rep1 f x) (Rep1 g y) Source #

Convert from the data type to its representation (or back)

_V1 :: Lens (V1 s) (V1 t) a b Source #

_U1 :: Iso (U1 p) (U1 q) () () Source #

_Par1 :: Iso (Par1 p) (Par1 q) p q Source #

_Rec1 :: Iso (Rec1 f p) (Rec1 g q) (f p) (g q) Source #

_K1 :: Iso (K1 i c p) (K1 j d q) c d Source #

_M1 :: forall i (c :: Meta) f p j (d :: Meta) g q. Iso (M1 i c f p) (M1 j d g q) (f p) (g q) Source #

_L1 :: forall a (c :: Type -> Type) t b. Prism ((a :+: c) t) ((b :+: c) t) (a t) (b t) Source #

_R1 :: forall (c :: Type -> Type) a t b. Prism ((c :+: a) t) ((c :+: b) t) (a t) (b t) Source #