vinyl-0.13.3: Extensible Records
Safe HaskellNone



Concise vinyl record field lens syntax. This module exports an orphan instance to make working with labels a bit more powerful. It will conflict with other libraries that provide special syntax for labels (i.e. placing a label in function application position, as in #age 23, or using a label as a lens).

Example: fieldRec (y =: b) :: FieldRec '[ '("x", Bool), '("y", Char) ] fieldRec (y =: b) & #x %~ not

Orphan instances

(HasField record s ts ts' t t', Functor f, RecElemFCtx record ElField, a' ~ (t -> f t'), b' ~ (record ElField ts -> f (record ElField ts'))) => IsLabel s (a' -> b') Source #

Concise record construction syntax. Example: record (age 23). instance forall s a b. (KnownSymbol s, b ~ ElField '(s,a)) => IsLabel s (a -> b) where #if 810 < 802 fromLabel _ = Field s a #else fromLabel = Field s a #endif

Concise ElField lenses. Example myRec & #name %~ map toUpper.

Credit to Tikhon Jelvis who shared this technique on the Haskell-Cafe mailing list on December 23, 2017.

Instance details


fromLabel :: a' -> b' #