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

Safe HaskellNone
LanguageHaskell2010

Generics.SOP.Lens.Named

Contents

Synopsis

Monomorphic total lens, abstracted over target

data NamedLens a ctxt Source #

Total abstract lens

Constructors

ctxt b => NamedLens 

Fields

Instances

Show (NamedLens a ctxt) Source # 

Methods

showsPrec :: Int -> NamedLens a ctxt -> ShowS #

show :: NamedLens a ctxt -> String #

showList :: [NamedLens a ctxt] -> ShowS #

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

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

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

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