vinyl-0.1.1.2: Extensible Records

Safe HaskellNone

Data.Vinyl.Rec

Synopsis

Documentation

data Rec whereSource

A record is parameterized by a list of fields and a functor to be applied to each of those fields.

Constructors

RNil :: Rec `[]` f 
:& :: f t -> Rec rs f -> Rec ((sy ::: t) : rs) f 

Instances

Run (Rec rs)

Records may be run to accumulate the effects of their fields.

(~ * y (::: sy t), IElem * y xs, <: (PlainRec xs) (PlainRec ys)) => (PlainRec xs) <: (PlainRec (: * y ys)) 
(Eq (g t), Eq (Rec fs g)) => Eq (Rec (: * (::: s t) fs) g) 
Eq (Rec ([] *) f) 
(SingI Symbol sy, Show (g t), Show (Rec fs g)) => Show (Rec (: * (::: sy t) fs) g) 
Show (Rec ([] *) f) 
Apply (* -> *) (~> *) (Rec rs)

Records can be applied to each other.

(Rec xs f) <: (Rec ([] *) f) 

type PlainRec rs = Rec rs IdentitySource

Fields of plain records are in the Identity functor.

(=:) :: Applicative f => (sy ::: t) -> t -> Rec `[sy ::: t]` fSource

Shorthand for a record with a single field. Lifts the field's value into the chosen functor automatically.

(<+>) :: Rec as f -> Rec bs f -> Rec (as ++ bs) fSource

Append for records.

fixRecord :: (forall f. Applicative f => Rec rs f) -> PlainRec rsSource

Fixes a polymorphic record into the Identity functor.