lens-sop-0.1.0.2: Computing lenses generically using generics-sop

Safe HaskellNone

Generics.SOP.Lens.Named

Contents

Synopsis

Monomorphic total lens, abstracted over target

data NamedLens a ctxt Source

Total abstract lens

Constructors

forall b . ctxt b => NamedLens 

Fields

unNamedLens :: GLens (->) (->) a b
 

Instances

Show (NamedLens a ctxt) 

get :: NamedLens a ctxt -> (forall b. ctxt b => b -> c) -> a -> cSource

modify :: NamedLens a ctxt -> (forall b. ctxt b => b -> b) -> a -> aSource

set :: NamedLens a ctxt -> (forall b. ctxt b => b) -> a -> aSource

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