Safe Haskell  None 

Language  Haskell2010 
Core vinyl definitions. The Rec
data type is defined here, but
also of interest are definitions commonly used functions like
rmap
, rapply
, and rtraverse
.
The definitions in this module are written in terms of type classes so that the definitions may be specialized to each record type at which they are used. This usually helps with runtime performance, but can slow down compilation time. If you are experiencing poor compile times, you may wish to try the semantically equivalent definitions in the Data.Vinyl.Recursive module: they should produce the same results given the same inputs as functions defined in this module, but they will not be specialized to your record type. Instead, they treat the record as a list of fields, so will have performance linear in the size of the record.
Synopsis
 data Rec :: (u > *) > [u] > * where
 rappend :: Rec f as > Rec f bs > Rec f (as ++ bs)
 (<+>) :: Rec f as > Rec f bs > Rec f (as ++ bs)
 class RMap rs where
 (<<$>>) :: RMap rs => (forall x. f x > g x) > Rec f rs > Rec g rs
 (<<&>>) :: RMap rs => Rec f rs > (forall x. f x > g x) > Rec g rs
 class RApply rs where
 (<<*>>) :: RApply rs => Rec (Lift (>) f g) rs > Rec f rs > Rec g rs
 class RecApplicative rs where
 rtraverse :: Applicative h => (forall x. f x > h (g x)) > Rec f rs > h (Rec g rs)
 class RZipWith xs where
 class RFoldMap rs where
 rfoldMap :: forall rs m f. (Monoid m, RFoldMap rs) => (forall x. f x > m) > Rec f rs > m
 class RecordToList rs where
 data Dict c a where
 class ReifyConstraint c f rs where
 class RPureConstrained c ts where
 class RPureConstraints cs ts where
Documentation
data Rec :: (u > *) > [u] > * where Source #
A record is parameterized by a universe u
, an interpretation f
and a
list of rows rs
. The labels or indices of the record are given by
inhabitants of the kind u
; the type of values at any label r :: u
is
given by its interpretation f r :: *
.
Instances
RecElem (Rec :: (a > *) > [a] > *) (r :: a) (r' :: a) (r ': rs :: [a]) (r' ': rs :: [a]) Z Source #  
Defined in Data.Vinyl.Lens type RecElemFCtx Rec f :: Constraint Source #  
(RIndex r (s ': rs) ~ S i, RecElem (Rec :: (a > *) > [a] > *) r r' rs rs' i) => RecElem (Rec :: (a > *) > [a] > *) (r :: a) (r' :: a) (s ': rs :: [a]) (s ': rs' :: [a]) (S i) Source #  
Defined in Data.Vinyl.Lens type RecElemFCtx Rec f :: Constraint Source #  
RecSubset (Rec :: (k > *) > [k] > *) ([] :: [k]) (ss :: [k]) ([] :: [Nat]) Source #  
Defined in Data.Vinyl.Lens type RecSubsetFCtx Rec f :: Constraint Source #  
(RElem r ss i, RSubset rs ss is) => RecSubset (Rec :: (k > *) > [k] > *) (r ': rs :: [k]) (ss :: [k]) (i ': is) Source #  
Defined in Data.Vinyl.Lens type RecSubsetFCtx Rec f :: Constraint Source #  
TestCoercion f => TestCoercion (Rec f :: [u] > *) Source #  
Defined in Data.Vinyl.Core  
TestEquality f => TestEquality (Rec f :: [u] > *) Source #  
Defined in Data.Vinyl.Core  
(Eq (f r), Eq (Rec f rs)) => Eq (Rec f (r ': rs)) Source #  
Eq (Rec f ([] :: [u])) Source #  
(Ord (f r), Ord (Rec f rs)) => Ord (Rec f (r ': rs)) Source #  
Defined in Data.Vinyl.Core compare :: Rec f (r ': rs) > Rec f (r ': rs) > Ordering # (<) :: Rec f (r ': rs) > Rec f (r ': rs) > Bool # (<=) :: Rec f (r ': rs) > Rec f (r ': rs) > Bool # (>) :: Rec f (r ': rs) > Rec f (r ': rs) > Bool # (>=) :: Rec f (r ': rs) > Rec f (r ': rs) > Bool # max :: Rec f (r ': rs) > Rec f (r ': rs) > Rec f (r ': rs) # min :: Rec f (r ': rs) > Rec f (r ': rs) > Rec f (r ': rs) #  
Ord (Rec f ([] :: [u])) Source #  
Defined in Data.Vinyl.Core  
(RMap rs, ReifyConstraint Show f rs, RecordToList rs) => Show (Rec f rs) Source #  Records may be shown insofar as their points may be shown.

(Semigroup (f r), Semigroup (Rec f rs)) => Semigroup (Rec f (r ': rs)) Source #  
Semigroup (Rec f ([] :: [u])) Source #  
(Monoid (f r), Monoid (Rec f rs)) => Monoid (Rec f (r ': rs)) Source #  
Monoid (Rec f ([] :: [u])) Source #  
(Storable (f r), Storable (Rec f rs)) => Storable (Rec f (r ': rs)) Source #  
Defined in Data.Vinyl.Core sizeOf :: Rec f (r ': rs) > Int # alignment :: Rec f (r ': rs) > Int # peekElemOff :: Ptr (Rec f (r ': rs)) > Int > IO (Rec f (r ': rs)) # pokeElemOff :: Ptr (Rec f (r ': rs)) > Int > Rec f (r ': rs) > IO () # peekByteOff :: Ptr b > Int > IO (Rec f (r ': rs)) # pokeByteOff :: Ptr b > Int > Rec f (r ': rs) > IO () #  
Storable (Rec f ([] :: [u])) Source #  
Defined in Data.Vinyl.Core  
type RecSubsetFCtx (Rec :: (k > *) > [k] > *) (f :: k > *) Source #  
Defined in Data.Vinyl.Lens  
type RecSubsetFCtx (Rec :: (k > *) > [k] > *) (f :: k > *) Source #  
Defined in Data.Vinyl.Lens  
type RecElemFCtx (Rec :: (a > *) > [a] > *) (f :: a > *) Source #  
Defined in Data.Vinyl.Lens  
type RecElemFCtx (Rec :: (a > *) > [a] > *) (f :: a > *) Source #  
Defined in Data.Vinyl.Lens 
(<<$>>) :: RMap rs => (forall x. f x > g x) > Rec f rs > Rec g rs infixl 8 Source #
A shorthand for rmap
.
(<<&>>) :: RMap rs => Rec f rs > (forall x. f x > g x) > Rec g rs Source #
An inverted shorthand for rmap
.
class RApply rs where Source #
A record of components f r > g r
may be applied to a record of f
to
get a record of g
.
(<<*>>) :: RApply rs => Rec (Lift (>) f g) rs > Rec f rs > Rec g rs infixl 8 Source #
A shorthand for rapply
.
class RecApplicative rs where Source #
Given a section of some functor, records in that functor of any size are inhabited.
Instances
RecApplicative ([] :: [u]) Source #  
Defined in Data.Vinyl.Core  
RecApplicative rs => RecApplicative (r ': rs :: [u]) Source #  
Defined in Data.Vinyl.Core 
rtraverse :: Applicative h => (forall x. f x > h (g x)) > Rec f rs > h (Rec g rs) Source #
A record may be traversed with respect to its interpretation functor. This can be used to yank (some or all) effects from the fields of the record to the outside of the record.
class RZipWith xs where Source #
Given a natural transformation from the product of f
and g
to h
, we
have a natural transformation from the product of
and Rec
f
to
Rec
g
. You can also think about this operation as zipping two records
with the same element types but different interpretations.Rec
h
class RFoldMap rs where Source #
Map each element of a record to a monoid and combine the results.
rfoldMapAux :: Monoid m => (forall x. f x > m) > m > Rec f rs > m Source #
Instances
RFoldMap ([] :: [u]) Source #  
Defined in Data.Vinyl.Core rfoldMapAux :: Monoid m => (forall (x :: u0). f x > m) > m > Rec f [] > m Source #  
RFoldMap xs => RFoldMap (x ': xs :: [u]) Source #  
Defined in Data.Vinyl.Core rfoldMapAux :: Monoid m => (forall (x0 :: u0). f x0 > m) > m > Rec f (x ': xs) > m Source # 
rfoldMap :: forall rs m f. (Monoid m, RFoldMap rs) => (forall x. f x > m) > Rec f rs > m Source #
class RecordToList rs where Source #
A record with uniform fields may be turned into a list.
recordToList :: Rec (Const a) rs > [a] Source #
Instances
RecordToList ([] :: [u]) Source #  
Defined in Data.Vinyl.Core recordToList :: Rec (Const a) [] > [a] Source #  
RecordToList xs => RecordToList (x ': xs :: [u]) Source #  
Defined in Data.Vinyl.Core recordToList :: Rec (Const a) (x ': xs) > [a] Source # 
Wrap up a value with a capability given by its type
class ReifyConstraint c f rs where Source #
Sometimes we may know something for all fields of a record, but when
you expect to be able to each of the fields, you are then out of luck.
Surely given ∀x:u.φ(x)
we should be able to recover x:u ⊢ φ(x)
! Sadly,
the constraint solver is not quite smart enough to realize this and we must
make it patently obvious by reifying the constraint pointwise with proof.
Instances
ReifyConstraint c (f :: u > *) ([] :: [u]) Source #  
Defined in Data.Vinyl.Core  
(c (f x), ReifyConstraint c f xs) => ReifyConstraint c (f :: a > *) (x ': xs :: [a]) Source #  
Defined in Data.Vinyl.Core 
class RPureConstrained c ts where Source #
Build a record whose elements are derived solely from a constraint satisfied by each.
rpureConstrained :: (forall a. c a => f a) > Rec f ts Source #
Instances
RPureConstrained (c :: u > Constraint) ([] :: [u]) Source #  
Defined in Data.Vinyl.Core rpureConstrained :: (forall (a :: u0). c a => f a) > Rec f [] Source #  
(c x, RPureConstrained c xs) => RPureConstrained (c :: a > Constraint) (x ': xs :: [a]) Source #  
Defined in Data.Vinyl.Core rpureConstrained :: (forall (a0 :: u). c a0 => f a0) > Rec f (x ': xs) Source # 
class RPureConstraints cs ts where Source #
Build a record whose elements are derived solely from a list of constraint constructors satisfied by each.
rpureConstraints :: (forall a. AllSatisfied cs a => f a) > Rec f ts Source #
Instances
RPureConstraints (cs :: [u > Constraint]) ([] :: [u]) Source #  
Defined in Data.Vinyl.Core rpureConstraints :: (forall (a :: u0). AllSatisfied cs a => f a) > Rec f [] Source #  
(AllSatisfied cs t, RPureConstraints cs ts) => RPureConstraints (cs :: [a > Constraint]) (t ': ts :: [a]) Source #  
Defined in Data.Vinyl.Core rpureConstraints :: (forall (a0 :: u). AllSatisfied cs a0 => f a0) > Rec f (t ': ts) Source # 