Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- module Data.Vinyl.Core
- class RecMapMethod c f ts where
- rmapMethod :: (forall a. c (PayloadType f a) => f a -> g a) -> Rec f ts -> Rec g ts
- class RecPointed c f ts where
- rpointMethod :: (forall a. c (f a) => f a) -> Rec f ts
- 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
- rtraverseInMethod :: forall c h f g rs. (RMap rs, RPureConstrained c rs, RApply rs) => (forall a. c a => f a -> g (ApplyToField h a)) -> Rec f rs -> Rec g (MapTyCon h rs)
- rsequenceInFields :: forall f rs. (Functor f, AllFields rs, RMap rs) => Rec (f :. ElField) rs -> Rec ElField (MapTyCon f rs)
- 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 g rs
- 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 ts where Source #
Apply a typeclass method to each field of a Rec
where the class
constrains the index of the field, but not its interpretation
functor.
rmapMethod :: (forall a. c (PayloadType f a) => f a -> g a) -> Rec f ts -> Rec g ts Source #
Instances
RecMapMethod c (f :: u -> Type) ([] :: [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 -> Type) (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 ts where Source #
Generate a record from fields derived from type class instances.
rpointMethod :: (forall a. c (f a) => f a) -> Rec f ts Source #
Instances
RecPointed c (f :: u -> Type) ([] :: [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 -> Type) (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
.
rtraverseInMethod :: forall c h f g rs. (RMap rs, RPureConstrained c rs, RApply rs) => (forall a. c a => f a -> g (ApplyToField h a)) -> Rec f rs -> Rec g (MapTyCon h rs) Source #
Like rtraverseIn
, but the function between functors may be
constrained.
rsequenceInFields :: forall f rs. (Functor f, AllFields rs, RMap rs) => Rec (f :. ElField) rs -> Rec ElField (MapTyCon f rs) Source #
Push an outer layer of interpretation functor into each named field.
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 -> Type) -> [k] -> Type) (rs :: [k]) (ss :: [k]) is Source # | |
Defined in Data.Vinyl.ARec type RecSubsetFCtx ARec f :: Constraint Source # | |
RecElem (ARec :: (a -> Type) -> [a] -> Type) (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 -> Type) -> [a] -> Type) t t' ts ts' i) => RecElem (ARec :: (a -> Type) -> [a] -> Type) (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 -> Type) -> [k] -> Type) (f :: k -> Type) Source # | |
Defined in Data.Vinyl.ARec | |
type RecElemFCtx (ARec :: (a -> Type) -> [a] -> Type) (f :: a -> Type) Source # | |
Defined in Data.Vinyl.ARec | |
type RecElemFCtx (ARec :: (a -> Type) -> [a] -> Type) (f :: a -> Type) 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
.
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.