HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulevinyl-0.14.3Haskell2010

Data.Vinyl.Syntax

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 (#x =: True, #y =: b) :: FieldRec '[ '("x", Bool), '("y", Char) ] fieldRec (#x =: True, #y =: b) & #x %~ not

    • Packagevinyl-0.14.3
    • Exports0
    • LanguageHaskell2010
    • LicenceMIT
    • SourceSyntax.hs

    Orphan instances

    1 instance
    • (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')

      Concise record construction syntax. Example: record (#name Joe, #age 23). instance forall s a b. (KnownSymbol s, b ~ ElField '(s,a)) => IsLabel s (a -> b) where #if 910 < 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.