Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- module Data.Vinyl.Core
- class RecMapMethod c (f :: u -> *) (ts :: [u]) where
- class RecPointed c (f :: u -> *) (ts :: [u]) where
- rmapMethodF :: forall c f ts. (Functor f, FieldPayload f ~ FieldId, RecMapMethod c f ts) => (forall a. c a => a -> a) -> Rec f ts -> Rec f ts
- mapFields :: forall c ts. RecMapMethod c ElField ts => (forall a. c a => a -> a) -> FieldRec ts -> FieldRec ts
- data ARec (f :: k -> *) (ts :: [k])
- toARec :: forall f ts. NatToInt (RLength ts) => Rec f ts -> ARec f ts
- fromARec :: forall f ts. (RecApplicative ts, RPureConstrained (IndexableField ts) ts) => ARec f ts -> Rec f ts
- module Data.Vinyl.Derived
- record :: TupleRec f t => t -> UncurriedRec (TupleToRecArgs f t)
- xrecX :: TupleXRec f t => ListToHKDTuple f t -> XRec f t
- xrecTuple :: TupleXRec f t => XRec f t -> ListToHKDTuple f t
- ruple :: (IsoXRec f ts, TupleXRec f ts) => Rec f ts -> ListToHKDTuple f ts
- xrec :: (IsoXRec f t, TupleXRec f t) => ListToHKDTuple f t -> Rec f t
- fieldRec :: TupleRec ElField t => t -> UncurriedRec (TupleToRecArgs ElField t)
- data ElField (field :: (Symbol, Type)) where
- Field :: KnownSymbol s => !t -> ElField '(s, t)
- module Data.Vinyl.Lens
- data SRec f ts
- toSRec :: Storable (Rec f ts) => Rec f ts -> SRec f ts
- fromSRec :: Storable (Rec f ts) => SRec f ts -> Rec f ts
- class IsoXRec f ts where
- class XRApply f g rs where
- class XRMap (f :: u -> *) (g :: u -> *) (rs :: [u])
- type XRec f = Rec (XData f)
- pattern XRNil :: XRec f '[]
- pattern (::&) :: HKD f r -> XRec f rs -> XRec f (r ': rs)
- rmapX :: forall f g rs. (XRMap f g rs, IsoXRec f rs, IsoXRec g rs) => (forall a. HKD f a -> HKD g a) -> Rec f rs -> Rec g rs
- xrmap :: forall f g rs. XRMap f g rs => (forall a. HKD f a -> HKD g a) -> XRec f rs -> XRec g rs
Documentation
module Data.Vinyl.Core
class RecMapMethod c (f :: u -> *) (ts :: [u]) where Source #
Apply a typeclass method to each field of a Rec
.
rmapMethod :: (forall a. c (PayloadType f a) => f a -> g a) -> Rec f ts -> Rec g ts Source #
Instances
RecMapMethod c (f :: u -> *) ([] :: [u]) Source # | |
Defined in Data.Vinyl.Class.Method rmapMethod :: (forall (a :: u0). c (PayloadType f a) => f a -> g a) -> Rec f [] -> Rec g [] Source # | |
(c (PayloadType f t), RecMapMethod c f ts) => RecMapMethod c (f :: a -> *) (t ': ts :: [a]) Source # | |
Defined in Data.Vinyl.Class.Method rmapMethod :: (forall (a0 :: u). c (PayloadType f a0) => f a0 -> g a0) -> Rec f (t ': ts) -> Rec g (t ': ts) Source # |
class RecPointed c (f :: u -> *) (ts :: [u]) where Source #
Generate a record from fields derived from type class instances.
rpointMethod :: (forall (a :: u). c (f a) => f a) -> Rec f ts Source #
Instances
RecPointed c (f :: u -> *) ([] :: [u]) Source # | |
Defined in Data.Vinyl.Class.Method rpointMethod :: (forall (a :: u0). c (f a) => f a) -> Rec f [] Source # | |
(c (f t), RecPointed c f ts) => RecPointed c (f :: a -> *) (t ': ts :: [a]) Source # | |
Defined in Data.Vinyl.Class.Method rpointMethod :: (forall (a0 :: u). c (f a0) => f a0) -> Rec f (t ': ts) Source # |
rmapMethodF :: forall c f ts. (Functor f, FieldPayload f ~ FieldId, RecMapMethod c f ts) => (forall a. c a => a -> a) -> Rec f ts -> Rec f ts Source #
Apply a typeclass method to each field of a Rec f ts
using the
Functor
instance for f
to lift the function into the
functor. This is a commonly-used specialization of rmapMethod
composed with fmap
.
mapFields :: forall c ts. RecMapMethod c ElField ts => (forall a. c a => a -> a) -> FieldRec ts -> FieldRec ts Source #
Apply a typeclass method to each field of a FieldRec
. This is a
specialization of rmapMethod
.
data ARec (f :: k -> *) (ts :: [k]) Source #
An array-backed extensible record with constant-time field access.
Instances
(is ~ RImage rs ss, IndexWitnesses is, NatToInt (RLength rs)) => RecSubset (ARec :: (k -> *) -> [k] -> *) (rs :: [k]) (ss :: [k]) is Source # | |
Defined in Data.Vinyl.ARec type RecSubsetFCtx ARec f :: Constraint Source # | |
RecElem (ARec :: (a -> *) -> [a] -> *) (t :: a) (t' :: a) (t ': ts :: [a]) (t' ': ts :: [a]) Z Source # | |
Defined in Data.Vinyl.ARec type RecElemFCtx ARec f :: Constraint Source # | |
(RIndex t (s ': ts) ~ S i, NatToInt i, RecElem (ARec :: (a -> *) -> [a] -> *) t t' ts ts' i) => RecElem (ARec :: (a -> *) -> [a] -> *) (t :: a) (t' :: a) (s ': ts :: [a]) (s ': ts' :: [a]) (S i) Source # | |
Defined in Data.Vinyl.ARec type RecElemFCtx ARec f :: Constraint Source # | |
(RPureConstrained (IndexableField rs) rs, RecApplicative rs, Eq (Rec f rs)) => Eq (ARec f rs) Source # | |
(RPureConstrained (IndexableField rs) rs, RecApplicative rs, Ord (Rec f rs)) => Ord (ARec f rs) Source # | |
Defined in Data.Vinyl.ARec | |
(RPureConstrained (IndexableField rs) rs, RecApplicative rs, Show (Rec f rs)) => Show (ARec f rs) Source # | |
type RecSubsetFCtx (ARec :: (k -> *) -> [k] -> *) (f :: k -> *) Source # | |
Defined in Data.Vinyl.ARec | |
type RecElemFCtx (ARec :: (a -> *) -> [a] -> *) (f :: a -> *) Source # | |
Defined in Data.Vinyl.ARec | |
type RecElemFCtx (ARec :: (a -> *) -> [a] -> *) (f :: a -> *) Source # | |
Defined in Data.Vinyl.ARec |
fromARec :: forall f ts. (RecApplicative ts, RPureConstrained (IndexableField ts) ts) => ARec f ts -> Rec f ts Source #
module Data.Vinyl.Derived
record :: TupleRec f t => t -> UncurriedRec (TupleToRecArgs f t) Source #
xrecTuple :: TupleXRec f t => XRec f t -> ListToHKDTuple f t Source #
Convert an XRec
to a tuple. Useful for pattern matching on an
entire record.
fieldRec :: TupleRec ElField t => t -> UncurriedRec (TupleToRecArgs ElField t) Source #
Build a FieldRec
from a tuple of ElField
values.
data ElField (field :: (Symbol, Type)) where Source #
A value with a phantom Symbol
label. It is not a
Haskell Functor
, but it is used in many of the same places a
Functor
is used in vinyl.
Field :: KnownSymbol s => !t -> ElField '(s, t) |
Instances
module Data.Vinyl.Lens
A simpler type for SRec2
whose RecElem
and RecSubset
instances are specialized to the ElField
functor.
Instances
class IsoXRec f ts where Source #
Conversion between XRec
and Rec
. It is convenient to build
and consume XRec
values to reduce syntactic noise, but Rec
has
a richer API that is difficult to build around the HKD
type
family.
class XRApply f g rs where Source #
Like rapply
: record of components f r -> g r
may be applied
to a record of f
to get a record of g
.
class XRMap (f :: u -> *) (g :: u -> *) (rs :: [u]) Source #
The implementation of xrmap
is broken into a type class to
permit unrolling of the recursion across a record. The function
mapped across the vector hides the HKD
type family under a newtype
constructor to help the type checker.