| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.Vinyl
Synopsis
- module Data.Vinyl.Core
- class RecMapMethod c (f :: u -> *) (ts :: [u]) where
- rmapMethod :: (forall a. c (PayloadType f a) => f a -> g a) -> Rec f ts -> Rec g ts
- class RecPointed c (f :: u -> *) (ts :: [u]) where
- rpointMethod :: (forall (a :: u). 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 :: 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 #
Apply a typeclass method to each field of a Rec where the class
constrains the index of the field, but not its interpretation
functor.
Methods
rmapMethod :: (forall a. c (PayloadType f a) => f a -> g a) -> Rec f ts -> Rec g ts #
Instances
| RecMapMethod c (f :: u -> Type) ([] :: [u]) # | |
Defined in Data.Vinyl.Class.Method Methods rmapMethod :: (forall (a :: u0). c (PayloadType f a) => f a -> g a) -> Rec f [] -> Rec g [] # | |
| (c (PayloadType f t), RecMapMethod c f ts) => RecMapMethod c (f :: a -> Type) (t ': ts :: [a]) # | |
Defined in Data.Vinyl.Class.Method Methods rmapMethod :: (forall (a0 :: u). c (PayloadType f a0) => f a0 -> g a0) -> Rec f (t ': ts) -> Rec g (t ': ts) # | |
class RecPointed c (f :: u -> *) (ts :: [u]) where #
Generate a record from fields derived from type class instances.
Methods
rpointMethod :: (forall (a :: u). c (f a) => f a) -> Rec f ts #
Instances
| RecPointed c (f :: u -> Type) ([] :: [u]) # | |
Defined in Data.Vinyl.Class.Method Methods rpointMethod :: (forall (a :: u0). c (f a) => f a) -> Rec f [] # | |
| (c (f t), RecPointed c f ts) => RecPointed c (f :: a -> Type) (t ': ts :: [a]) # | |
Defined in Data.Vinyl.Class.Method Methods rpointMethod :: (forall (a0 :: u). c (f a0) => f a0) -> Rec f (t ': 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 #
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 #
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) #
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) #
Push an outer layer of interpretation functor into each named field.
data ARec (f :: k -> *) (ts :: [k]) #
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 # | |
Defined in Data.Vinyl.ARec Associated Types type RecSubsetFCtx ARec f :: Constraint # | |
| RecElem (ARec :: (a -> Type) -> [a] -> Type) (t :: a) (t' :: a) (t ': ts :: [a]) (t' ': ts :: [a]) Z # | |
Defined in Data.Vinyl.ARec Associated Types type RecElemFCtx ARec f :: Constraint # | |
| (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) # | |
Defined in Data.Vinyl.ARec Associated Types type RecElemFCtx ARec f :: Constraint # | |
| (RPureConstrained (IndexableField rs) rs, RecApplicative rs, Eq (Rec f rs)) => Eq (ARec f rs) # | |
| (RPureConstrained (IndexableField rs) rs, RecApplicative rs, Ord (Rec f rs)) => Ord (ARec f rs) # | |
| (RPureConstrained (IndexableField rs) rs, RecApplicative rs, Show (Rec f rs)) => Show (ARec f rs) # | |
| type RecSubsetFCtx (ARec :: (k -> Type) -> [k] -> Type) (f :: k -> Type) # | |
Defined in Data.Vinyl.ARec | |
| type RecElemFCtx (ARec :: (a -> Type) -> [a] -> Type) (f :: a -> Type) # | |
Defined in Data.Vinyl.ARec | |
| type RecElemFCtx (ARec :: (a -> Type) -> [a] -> Type) (f :: a -> Type) # | |
Defined in Data.Vinyl.ARec | |
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) #
xrecTuple :: TupleXRec f t => XRec f t -> ListToHKDTuple f t #
Convert an XRec to a tuple. Useful for pattern matching on an
entire record.
fieldRec :: TupleRec ElField t => t -> UncurriedRec (TupleToRecArgs ElField t) #
Build a FieldRec from a tuple of ElField values.
data ElField (field :: (Symbol, Type)) where #
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.
Constructors
| 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
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.
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]) #
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.
Minimal complete definition