| Safe Haskell | Trustworthy |
|---|---|
| Language | Haskell2010 |
Data.Vinyl.ARec
Description
Constant-time field accessors for extensible records. The trade-off is the usual lists vs arrays one: it is fast to add an element to the head of a list, but element access is linear time; array access time is uniform, but extending the array is more slower.
Synopsis
- data ARec (f :: k -> Type) (ts :: [k])
- class NatToInt (RIndex t ts) => IndexableField (ts :: [k]) (t :: k)
- class ToARec (us :: [k])
- toARec :: forall {k} (f :: k -> Type) (ts :: [k]). (NatToInt (RLength ts), ToARec ts) => Rec f ts -> ARec f ts
- fromARec :: forall {u} (f :: u -> Type) (ts :: [u]). (RecApplicative ts, RPureConstrained (IndexableField ts) ts) => ARec f ts -> Rec f ts
- aget :: forall {k} (t :: k) f (ts :: [k]). NatToInt (RIndex t ts) => ARec f ts -> f t
- arecGetSubset :: forall {k} (rs :: [k]) (ss :: [k]) (f :: k -> Type). (IndexWitnesses (RImage rs ss), NatToInt (RLength rs)) => ARec f ss -> ARec f rs
- arecSetSubset :: forall {k} (rs :: [k]) (ss :: [k]) (f :: k -> Type). IndexWitnesses (RImage rs ss) => ARec f ss -> ARec f rs -> ARec f ss
- arecRepsMatchCoercion :: forall {k1} {k2} (f :: k1 -> Type) (xs :: [k1]) (g :: k2 -> Type) (ys :: [k2]). AllRepsMatch f xs g ys => Coercion (ARec f xs) (ARec g ys)
- arecConsMatchCoercion :: forall k (f :: k -> Type) (g :: k -> Type) (xs :: [k]). (forall (x :: k). Coercible (f x) (g x)) => Coercion (ARec f xs) (ARec g xs)
Documentation
data ARec (f :: k -> Type) (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 :: (k1 -> Type) -> [k1] -> Type) (rs :: [k1]) (ss :: [k1]) is Source # | |
Defined in Data.Vinyl.ARec.Internal Methods rsubsetC :: forall g (f :: k1 -> Type). (Functor g, RecSubsetFCtx (ARec :: (k1 -> Type) -> [k1] -> Type) f) => (ARec f rs -> g (ARec f rs)) -> ARec f ss -> g (ARec f ss) Source # rcastC :: forall (f :: k1 -> Type). RecSubsetFCtx (ARec :: (k1 -> Type) -> [k1] -> Type) f => ARec f ss -> ARec f rs Source # rreplaceC :: forall (f :: k1 -> Type). RecSubsetFCtx (ARec :: (k1 -> Type) -> [k1] -> Type) f => ARec f rs -> ARec f ss -> ARec f ss Source # | |
| RecElem (ARec :: (a -> Type) -> [a] -> Type) (t :: a) (t' :: a) (t ': ts :: [a]) (t' ': ts :: [a]) 'Z Source # | |
Defined in Data.Vinyl.ARec.Internal Methods rlensC :: (Functor g, RecElemFCtx (ARec :: (a -> Type) -> [a] -> Type) f) => (f t -> g (f t')) -> ARec f (t ': ts) -> g (ARec f (t' ': ts)) Source # rgetC :: (RecElemFCtx (ARec :: (a -> Type) -> [a] -> Type) f, t ~ t') => ARec f (t ': ts) -> f t Source # rputC :: RecElemFCtx (ARec :: (a -> Type) -> [a] -> Type) f => f t' -> ARec f (t ': ts) -> ARec f (t' ': ts) 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.Internal Methods rlensC :: (Functor g, RecElemFCtx (ARec :: (a -> Type) -> [a] -> Type) f) => (f t -> g (f t')) -> ARec f (s ': ts) -> g (ARec f (s ': ts')) Source # rgetC :: (RecElemFCtx (ARec :: (a -> Type) -> [a] -> Type) f, t ~ t') => ARec f (s ': ts) -> f t Source # rputC :: RecElemFCtx (ARec :: (a -> Type) -> [a] -> Type) f => f t' -> ARec f (s ': ts) -> ARec f (s ': ts') Source # | |
| (RPureConstrained (IndexableField rs) rs, RecApplicative rs, Show (Rec f rs)) => Show (ARec f rs) 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 # | |
| type RecSubsetFCtx (ARec :: (k1 -> Type) -> [k1] -> Type) (f :: k1 -> Type) Source # | |
Defined in Data.Vinyl.ARec.Internal | |
| type RecElemFCtx (ARec :: (a -> Type) -> [a] -> Type) (f :: a -> Type) Source # | |
Defined in Data.Vinyl.ARec.Internal | |
| type RecElemFCtx (ARec :: (a -> Type) -> [a] -> Type) (f :: a -> Type) Source # | |
Defined in Data.Vinyl.ARec.Internal | |
class NatToInt (RIndex t ts) => IndexableField (ts :: [k]) (t :: k) Source #
Instances
| NatToInt (RIndex t ts) => IndexableField (ts :: [k]) (t :: k) Source # | |
Defined in Data.Vinyl.ARec.Internal | |
class ToARec (us :: [k]) Source #
Minimal complete definition
aRecValues
Instances
| ToARec ('[] :: [k]) Source # | |
Defined in Data.Vinyl.ARec.Internal Methods aRecValues :: forall (f :: k -> Type). Rec f ('[] :: [k]) -> ARecBuilder f ('[] :: [k]) | |
| ToARec us => ToARec (u ': us :: [k]) Source # | |
Defined in Data.Vinyl.ARec.Internal Methods aRecValues :: forall (f :: k -> Type). Rec f (u ': us) -> ARecBuilder f (u ': us) | |
toARec :: forall {k} (f :: k -> Type) (ts :: [k]). (NatToInt (RLength ts), ToARec ts) => Rec f ts -> ARec f ts Source #
fromARec :: forall {u} (f :: u -> Type) (ts :: [u]). (RecApplicative ts, RPureConstrained (IndexableField ts) ts) => ARec f ts -> Rec f ts Source #
aget :: forall {k} (t :: k) f (ts :: [k]). NatToInt (RIndex t ts) => ARec f ts -> f t Source #
Get a field from an ARec.
arecGetSubset :: forall {k} (rs :: [k]) (ss :: [k]) (f :: k -> Type). (IndexWitnesses (RImage rs ss), NatToInt (RLength rs)) => ARec f ss -> ARec f rs Source #
Get a subset of a record's fields.
arecSetSubset :: forall {k} (rs :: [k]) (ss :: [k]) (f :: k -> Type). IndexWitnesses (RImage rs ss) => ARec f ss -> ARec f rs -> ARec f ss Source #
Set a subset of a larger record's fields to all of the fields of a smaller record.
arecRepsMatchCoercion :: forall {k1} {k2} (f :: k1 -> Type) (xs :: [k1]) (g :: k2 -> Type) (ys :: [k2]). AllRepsMatch f xs g ys => Coercion (ARec f xs) (ARec g ys) Source #
arecConsMatchCoercion :: forall k (f :: k -> Type) (g :: k -> Type) (xs :: [k]). (forall (x :: k). Coercible (f x) (g x)) => Coercion (ARec f xs) (ARec g xs) Source #
Given that forall x. Coercible (f x) (g x), produce a coercion from
ARec f xs to ARec g xs. While the constraint looks a lot like
Coercible f g, it is actually weaker.