Modulevinyl-0.14.3Haskell2010
Data.Vinyl.XRec
A variant of Rec whose values have eliminated common syntactic clutter due to Identity, Compose, and ElField type constructors.
A common pain point with using Rec is the mandatory context of
each value. A basic record might look like this, Identity "joe" :&
Identity 23 :& RNil :: Rec Identity '[String, Int]. The Identity
constructors are a nuisance, so we offer a way of avoiding them:
"joe" ::& 23 ::& XRNil :: XRec Identity '[String,Int]. Facilities
are provided for converting between XRec and Rec so that the
Rec API is available even if you choose to use XRec for
construction or pattern matching.
- 2 types
- 4 classes
- 4 values
- Packagevinyl-0.14.3
- Exports12
- LanguageHaskell2010
- LicenceMIT
- SourceXRec.hs
This is rmapX specialized to a type at which it does not change interpretation functor. This can help with type inference.
This is rmap for XRec. We apply a natural transformation
between interpretation functors to transport a record value between
interpretations.
Like rapply: record of components f r -> g r may be applied
to a record of f to get a record of g.
Isomorphism between a syntactically noisy value and a concise
one. For types like, Identity, we prefer to work with values of
the underlying type without writing out the Identity
constructor. For Compose f g a, aka (f :. g) a, we prefer to
work directly with values of type f (g a).
This involves the so-called higher-kinded data type family. See http://reasonablypolymorphic.com/blog/higher-kinded-data for more discussion.
Instances12IsoHKD, …
IsoHKD First aDefined in vinyl-0.14.3 · Data.Vinyl.XRecIsoHKD Last aDefined in vinyl-0.14.3 · Data.Vinyl.XRecIsoHKD Product aDefined in vinyl-0.14.3 · Data.Vinyl.XRecWork with values of type Product
aas if they were of typea.IsoHKD Sum aDefined in vinyl-0.14.3 · Data.Vinyl.XRecWork with values of type Sum
aas if they were of typea.IsoHKD Maybe aDefined in vinyl-0.14.3 · Data.Vinyl.XRecIsoHKD IO aDefined in vinyl-0.14.3 · Data.Vinyl.XRecIsoHKD Identity aDefined in vinyl-0.14.3 · Data.Vinyl.XRecWork with values of type Identity
aas if they were simple of typea.IsoHKD (Either a) bDefined in vinyl-0.14.3 · Data.Vinyl.XRecIsoHKD (Tuple2 a) bDefined in vinyl-0.14.3 · Data.Vinyl.XRec(IsoHKD f (HKD g a), IsoHKD g a, Functor f) => IsoHKD (Compose f g) aDefined in vinyl-0.14.3 · Data.Vinyl.XRecWork with values of type Compose
f g aas if they were of typef (g a).(IsoHKD f a, IsoHKD g a) => IsoHKD (Lift (->) f g) aDefined in vinyl-0.14.3 · Data.Vinyl.XRecWork with values of type Lift
(->) f g aas if they were of typef a -> g a.KnownSymbol s => IsoHKD ElField '(s, a)Defined in vinyl-0.14.3 · Data.Vinyl.XRecWork with values of type ElField
'(s,a)as if they were of typea.
Record field getter that pipes the field value through HKD to
eliminate redundant newtype wrappings. Usage will typically involve
a visible type application to the field type. The definition is
similar to, getHKD = toHKD . rget.