vinyl-0.4.3: Extensible Records

Safe HaskellNone
LanguageHaskell2010

Data.Vinyl.Lens

Description

A small, en passant lens implementation to provide accessors for record fields. Lenses produced with rLens are fully compatible with the lens package.

Synopsis

Documentation

rGet' :: r rs => sing r -> Rec el f rs -> f (el $ r) Source

Project a field from a Rec.

rGet :: r rs => sing r -> PlainRec el rs -> el $ r Source

Project a field from a PlainRec.

rPut' :: r rs => sing r -> f (el $ r) -> Rec el f rs -> Rec el f rs Source

Set a field in a Rec over an arbitrary functor.

rPut :: r rs => sing r -> (el $ r) -> PlainRec el rs -> PlainRec el rs Source

Set a field in a PlainRec.

rMod :: (r rs, Functor f) => sing r -> ((el $ r) -> el $ r) -> Rec el f rs -> Rec el f rs Source

Modify a field.

rLens' :: forall r rs f g el sing. (r rs, Functor g) => sing r -> (f (el $ r) -> g (f (el $ r))) -> Rec el f rs -> g (Rec el f rs) Source

Provide a lens to a record field. Note that this implementation does not support polymorphic update. In the parlance of the lens package,

rLens' :: (r ∈ rs) => Sing r -> Lens' (Rec el f rs) (f (el $ r))

rLens :: forall r rs g el sing. (r rs, Functor g) => sing r -> ((el $ r) -> g (el $ r)) -> PlainRec el rs -> g (PlainRec el rs) Source

A lens into a PlainRec that smoothly interoperates with lenses from the lens package. Note that polymorphic update is not supported. In the parlance of the lens package,

rLens :: (r ∈ rs) => sing r -> Lens' (PlainRec el rs) (el $ r)