lens-4.18.1: 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 => Iso' a (Rep a b)
- generic1 :: Generic1 f => Iso (f a) (f b) (Rep1 f a) (Rep1 f b)
- _V1 :: Over p f (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 :: Iso (M1 i c f p) (M1 j d g q) (f p) (g q)
- _L1 :: Prism' ((f :+: g) a) (f a)
- _R1 :: Prism' ((f :+: g) a) (g a)
- _UAddr :: Iso (UAddr p) (UAddr q) (Ptr c) (Ptr d)
- _UChar :: Iso (UChar p) (UChar q) Char Char
- _UDouble :: Iso (UDouble p) (UDouble q) Double Double
- _UFloat :: Iso (UFloat p) (UFloat q) Float Float
- _UInt :: Iso (UInt p) (UInt q) Int Int
- _UWord :: Iso (UWord p) (UWord q) Word Word

# Documentation

generic :: Generic a => Iso' a (Rep a b) Source #

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

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

generic1 :: Generic1 f => Iso (f a) (f b) (Rep1 f a) (Rep1 f b) Source #

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

_V1 :: Over p f (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 :: Iso (M1 i c f p) (M1 j d g q) (f p) (g q) Source #

_L1 :: Prism' ((f :+: g) a) (f a) Source #

_R1 :: Prism' ((f :+: g) a) (g a) Source #

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

_UAddr :: Iso (UAddr p) (UAddr q) (Ptr c) (Ptr d) Source #

_UChar :: Iso (UChar p) (UChar q) Char Char Source #

_UDouble :: Iso (UDouble p) (UDouble q) Double Double Source #

_UFloat :: Iso (UFloat p) (UFloat q) Float Float Source #

_UInt :: Iso (UInt p) (UInt q) Int Int Source #

_UWord :: Iso (UWord p) (UWord q) Word Word Source #