lens-5.2.3: Lenses, Folds and Traversals

Copyright | (C) 2012-16 Edward Kmett
License | BSD-style (see the file LICENSE)
Maintainer | Edward Kmett <ekmett@gmail.com>
Stability | experimental
Portability | GHC
Safe Haskell | None
Language | Haskell2010

GHC.Generics.Lens

Description

You can use hiding or imports to mitigate this to an extent, and the following imports, represent a fair compromise for user code:

    import Control.Lens hiding (Rep)
    import GHC.Generics hiding (from, to)

You can use `generic` to replace `from` and `to` from `GHC.Generics`, and probably won't be explicitly referencing `Rep` from `Control.Lens` in code that uses generics.

This module provides compatibility with older GHC versions by using the generic-deriving package.

Synopsis

- generic :: (Generic a, Generic b) => Iso a b (Rep a g) (Rep b h)
- generic1 :: forall {k1} {k2} (f :: k1 -> Type) (g :: k2 -> Type) (a :: k1) (b :: k2). (Generic1 f, Generic1 g) => Iso (f a) (g b) (Rep1 f a) (Rep1 g b)
- _V1 :: forall {k1} {k2} {k3} p f (s :: k2) (t :: k3) (a :: k1) b. Over p f (V1 s) (V1 t) a b
- _U1 :: forall {k1} {k2} (p1 :: k1) (q :: k2) p2 f. (Profunctor p2, Functor f) => p2 () (f ()) -> p2 (U1 p1) (f (U1 q))
- _Par1 :: forall p1 q p2 f. (Profunctor p2, Functor f) => p2 p1 (f q) -> p2 (Par1 p1) (f (Par1 q))
- _Rec1 :: forall {k1} {k2} f1 (p1 :: k1) g (q :: k2) p2 f2. (Profunctor p2, Functor f2) => p2 (f1 p1) (f2 (g q)) -> p2 (Rec1 f1 p1) (f2 (Rec1 g q))
- _K1 :: forall {k1} {k2} i c (p1 :: k1) j d (q :: k2) p2 f. (Profunctor p2, Functor f) => p2 c (f d) -> p2 (K1 i c p1) (f (K1 j d q))
- _M1 :: forall {k1} {k2} i (c :: Meta) f1 (p1 :: k1) j (d :: Meta) g (q :: k2) p2 f2. (Profunctor p2, Functor f2) => p2 (f1 p1) (f2 (g q)) -> p2 (M1 i c f1 p1) (f2 (M1 j d g q))
- _L1 :: forall {k} f1 (g :: k -> Type) (a :: k) p f2. (Choice p, Applicative f2) => p (f1 a) (f2 (f1 a)) -> p ((f1 :+: g) a) (f2 ((f1 :+: g) a))
- _R1 :: forall {k} (f1 :: k -> Type) g (a :: k) p f2. (Choice p, Applicative f2) => p (g a) (f2 (g a)) -> p ((f1 :+: g) a) (f2 ((f1 :+: g) a))
- _UAddr :: forall {k1} {k2} (p1 :: k1) (q :: k2) c d p2 f. (Profunctor p2, Functor f) => p2 (Ptr c) (f (Ptr d)) -> p2 (UAddr p1) (f (UAddr q))
- _UChar :: forall {k1} {k2} (p1 :: k1) (q :: k2) p2 f. (Profunctor p2, Functor f) => p2 Char (f Char) -> p2 (UChar p1) (f (UChar q))
- _UDouble :: forall {k1} {k2} (p1 :: k1) (q :: k2) p2 f. (Profunctor p2, Functor f) => p2 Double (f Double) -> p2 (UDouble p1) (f (UDouble q))
- _UFloat :: forall {k1} {k2} (p1 :: k1) (q :: k2) p2 f. (Profunctor p2, Functor f) => p2 Float (f Float) -> p2 (UFloat p1) (f (UFloat q))
- _UInt :: forall {k1} {k2} (p1 :: k1) (q :: k2) p2 f. (Profunctor p2, Functor f) => p2 Int (f Int) -> p2 (UInt p1) (f (UInt q))
- _UWord :: forall {k1} {k2} (p1 :: k1) (q :: k2) p2 f. (Profunctor p2, Functor f) => p2 Word (f Word) -> p2 (UWord p1) (f (UWord q))

# Documentation

generic :: (Generic a, Generic b) => Iso a b (Rep a g) (Rep b h) #

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

    >>> "hello"^.generic.from generic :: String
    "hello"

generic1 :: forall {k1} {k2} (f :: k1 -> Type) (g :: k2 -> Type) (a :: k1) (b :: k2). (Generic1 f, Generic1 g) => Iso (f a) (g b) (Rep1 f a) (Rep1 g b) #

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

_V1 :: forall {k1} {k2} {k3} p f (s :: k2) (t :: k3) (a :: k1) b. Over p f (V1 s) (V1 t) a b #

_U1 :: forall {k1} {k2} (p1 :: k1) (q :: k2) p2 f. (Profunctor p2, Functor f) => p2 () (f ()) -> p2 (U1 p1) (f (U1 q)) #

_Par1 :: forall p1 q p2 f. (Profunctor p2, Functor f) => p2 p1 (f q) -> p2 (Par1 p1) (f (Par1 q)) #

_Rec1 :: forall {k1} {k2} f1 (p1 :: k1) g (q :: k2) p2 f2. (Profunctor p2, Functor f2) => p2 (f1 p1) (f2 (g q)) -> p2 (Rec1 f1 p1) (f2 (Rec1 g q)) #

_K1 :: forall {k1} {k2} i c (p1 :: k1) j d (q :: k2) p2 f. (Profunctor p2, Functor f) => p2 c (f d) -> p2 (K1 i c p1) (f (K1 j d q)) #

_M1 :: forall {k1} {k2} i (c :: Meta) f1 (p1 :: k1) j (d :: Meta) g (q :: k2) p2 f2. (Profunctor p2, Functor f2) => p2 (f1 p1) (f2 (g q)) -> p2 (M1 i c f1 p1) (f2 (M1 j d g q)) #

_L1 :: forall {k} f1 (g :: k -> Type) (a :: k) p f2. (Choice p, Applicative f2) => p (f1 a) (f2 (f1 a)) -> p ((f1 :+: g) a) (f2 ((f1 :+: g) a)) #

_R1 :: forall {k} (f1 :: k -> Type) g (a :: k) p f2. (Choice p, Applicative f2) => p (g a) (f2 (g a)) -> p ((f1 :+: g) a) (f2 ((f1 :+: g) a)) #

You can access fields of `data (f :*: g) p` by using its `Field1` and `Field2` instances.

_UAddr :: forall {k1} {k2} (p1 :: k1) (q :: k2) c d p2 f. (Profunctor p2, Functor f) => p2 (Ptr c) (f (Ptr d)) -> p2 (UAddr p1) (f (UAddr q)) #

_UChar :: forall {k1} {k2} (p1 :: k1) (q :: k2) p2 f. (Profunctor p2, Functor f) => p2 Char (f Char) -> p2 (UChar p1) (f (UChar q)) #

_UDouble :: forall {k1} {k2} (p1 :: k1) (q :: k2) p2 f. (Profunctor p2, Functor f) => p2 Double (f Double) -> p2 (UDouble p1) (f (UDouble q)) #

_UFloat :: forall {k1} {k2} (p1 :: k1) (q :: k2) p2 f. (Profunctor p2, Functor f) => p2 Float (f Float) -> p2 (UFloat p1) (f (UFloat q)) #

_UInt :: forall {k1} {k2} (p1 :: k1) (q :: k2) p2 f. (Profunctor p2, Functor f) => p2 Int (f Int) -> p2 (UInt p1) (f (UInt q)) #

_UWord :: forall {k1} {k2} (p1 :: k1) (q :: k2) p2 f. (Profunctor p2, Functor f) => p2 Word (f Word) -> p2 (UWord p1) (f (UWord q)) #