Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type LensName = String
- data NamedLens a ctxt = forall b . ctxt b => NamedLens {
- unNamedLens :: GLens (->) (->) a b
- get :: NamedLens a ctxt -> (forall b. ctxt b => b -> c) -> a -> c
- modify :: NamedLens a ctxt -> (forall b. ctxt b => b -> b) -> a -> a
- set :: NamedLens a ctxt -> (forall b. ctxt b => b) -> a -> a
- gnamedLenses :: forall a ctxt xs. (Generic a, HasDatatypeInfo a, Code a ~ `[xs]`, All ctxt xs) => (DatatypeName -> ConstructorName -> LensName) -> [(String, NamedLens a ctxt)]
Monomorphic total lens, abstracted over target
Total abstract lens
forall b . ctxt b => NamedLens | |
|
Generic construction
gnamedLenses :: forall a ctxt xs. (Generic a, HasDatatypeInfo a, Code a ~ `[xs]`, All ctxt xs) => (DatatypeName -> ConstructorName -> LensName) -> [(String, NamedLens a ctxt)] Source
Construct named lenses for a record type
NOTE: This will throw a runtime error for non-record types