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 | Haskell98 |
Note: Generics.Deriving
exports a number of names that collide with Control.Lens
.
You can use hiding to mitigate this to an extent, and the following import represents a fair compromise for user code:
import Generics.Deriving hiding (from, to)
You can use generic
to replace from
and
to
from Generics.Deriving
.
- generic :: Generic a => Iso' a (Rep a b)
- generic1 :: Generic1 f => Iso' (f a) (Rep1 f a)
- tinplate :: (Generic a, GTraversal (Rep a), Typeable b) => Traversal' a b
- class GTraversal f
Isomorphisms for GHC.Generics
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) (Rep1 f a) Source
Convert from the data type to its representation (or back)
Generic Traversal
tinplate :: (Generic a, GTraversal (Rep a), Typeable b) => Traversal' a b Source
class GTraversal f Source
Used to traverse Generic
data by uniplate
.
tinplated
GTraversal V1 Source | |
GTraversal U1 Source | |
(Generic a, GTraversal (Rep a), Typeable * a) => GTraversal (K1 i a) Source | |
(GTraversal f, GTraversal g) => GTraversal ((:+:) f g) Source | |
(GTraversal f, GTraversal g) => GTraversal ((:*:) f g) Source | |
GTraversal a => GTraversal (M1 i c a) Source | |