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.FromTuple

Concise vinyl record construction from tuples up to size 8. An example record construction using ElField for named fields: fieldRec (#x =: True, #y =: b) :: FieldRec '[ '("x", Bool), '("y", Char) ]

  • 2 classes
  • 5 values
  • Packagevinyl-0.14.3
  • Exports11
  • LanguageHaskell2010
  • LicenceMIT
  • SourceFromTuple.hs
familytype family TupleToRecArgs (f :: u -> Type) t :: (u -> Type, [u]) where
#

Convert a tuple of types formed by the application of a common type constructor to a tuple of the common type constructor and a list of the types to which it is applied in the original tuple. E.g. TupleToRecArgs f (f a, f b) ~ (f, [a,b]).

Equations

familytype family UncurriedRec (t :: (u -> Type, [u])) where
#

Apply the Rec type constructor to a type-level tuple of its arguments.

Equations

classclass TupleXRec (f :: u -> Type) (t :: [u]) where
#

Convert between an XRec and an isomorphic tuple.

Methods

Instances7TupleXRec, …
  • TupleXRec f '[a, b, c, d, e, z, g, h]Defined in vinyl-0.14.3 · Data.Vinyl.FromTuple
  • TupleXRec f '[a, b, c, d, e, z, g]Defined in vinyl-0.14.3 · Data.Vinyl.FromTuple
  • TupleXRec f '[a, b, c, d, e, z]Defined in vinyl-0.14.3 · Data.Vinyl.FromTuple
  • TupleXRec f '[a, b, c, d, e]Defined in vinyl-0.14.3 · Data.Vinyl.FromTuple
  • TupleXRec f '[a, b, c, d]Defined in vinyl-0.14.3 · Data.Vinyl.FromTuple
  • TupleXRec f '[a, b, c]Defined in vinyl-0.14.3 · Data.Vinyl.FromTuple
  • TupleXRec f '[a, b]Defined in vinyl-0.14.3 · Data.Vinyl.FromTuple
familytype family ListToHKDTuple (f :: u -> Type) (ts :: [u]) where
#

Equations

valuexrec :: (IsoXRec f t, TupleXRec f t) => ListToHKDTuple f t -> Rec f t
#

Build a Rec from a tuple passing through XRec. This admits the most concise syntax for building a Rec. For example, xrec ("joe", 23) :: Rec Identity '[String, Int].

classclass TupleRec (f :: u -> Type) t where
#

Build a Rec from a tuple. An example would be building a value of type Rec f '[a,b] from a tuple of values with type '(f a, f b).

Methods

Instances8TupleRec, …
  • TupleRec f ()Defined in vinyl-0.14.3 · Data.Vinyl.FromTuple
  • TupleRec f (f a, f b)Defined in vinyl-0.14.3 · Data.Vinyl.FromTuple
  • TupleRec f (f a, f b, f c)Defined in vinyl-0.14.3 · Data.Vinyl.FromTuple
  • TupleRec f (f a, f b, f c, f d)Defined in vinyl-0.14.3 · Data.Vinyl.FromTuple
  • TupleRec f (f a, f b, f c, f d, f e)Defined in vinyl-0.14.3 · Data.Vinyl.FromTuple
  • TupleRec f (f a, f b, f c, f d, f e, f z)Defined in vinyl-0.14.3 · Data.Vinyl.FromTuple
  • TupleRec f (f a, f b, f c, f d, f e, f z, f g)Defined in vinyl-0.14.3 · Data.Vinyl.FromTuple
  • TupleRec f (f a, f b, f c, f d, f e, f z, f g, f h)Defined in vinyl-0.14.3 · Data.Vinyl.FromTuple

Build a FieldRec from a tuple and rcast it to another record type that is a subset of the constructed record. This is useful for re-ordering fields. For example, namedArgs (#name =: "joe", #age =: 23) can supply arguments for a function expecting a record of arguments with its fields in the opposite order.

valuewithDefaults
  1. :: (RMap rs, RApply rs, ss ⊆ rs, RMap ss, RecApplicative rs)
  2. => Rec f rs
  3. -> Rec f ss
  4. -> Rec f rs
#

Override a record with fields from a possibly narrower record. A typical use is to supply default values as the first argument, and overrides for those defaults as the second.