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. instance forall s a b. (KnownSymbol s, b ~ ElField '(s,a)) => IsLabel s (a -> b) where #if 910 < 802 fromLabel _ = FieldJoe, #age 23)sa #else fromLabel = Fieldsa #endifConcise 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.