Portability | GHC |
---|---|
Stability | experimental |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Safe Haskell | None |
Note: GHC.Generics
exports a number of names that collide with Control.Lens
.
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.
Isomorphisms for GHC.Generics
generic :: Generic a => Simple 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 => Simple Iso (f a) (Rep1 f a)Source
Convert from the data type to its representation (or back)
Generic Traversal
class GTraversal f Source
Used to traverse Generic
data by uniplate
.
GTraversal U1 | |
(Generic a, GTraversal (Rep a), Typeable a) => GTraversal (K1 i a) | |
(GTraversal f, GTraversal g) => GTraversal (:+: f g) | |
(GTraversal f, GTraversal g) => GTraversal (:*: f g) | |
(Traversable f, GTraversal g) => GTraversal (:.: f g) | |
GTraversal a => GTraversal (M1 i c a) |