Safe Haskell | None |
---|---|
Language | Haskell2010 |
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.
- newtype ARec (f :: k -> *) (ts :: [k]) = ARec (Array Int Any)
- toARec :: forall f ts. NatToInt (RLength ts) => Rec f ts -> ARec f ts
- class NatToInt (RIndex t ts) => IndexableField ts t
- fromARec :: forall f ts. (RecApplicative ts, AllConstrained (IndexableField ts) ts) => ARec f ts -> Rec f ts
- aget :: forall t f ts. NatToInt (RIndex t ts) => ARec f ts -> f t
- aput :: forall t f ts. NatToInt (RIndex t ts) => f t -> ARec f ts -> ARec f ts
- alens :: (Functor g, NatToInt (RIndex t ts)) => (f t -> g (f t)) -> ARec f ts -> g (ARec f ts)
- arecGetSubset :: forall rs ss f. (IndexWitnesses (RImage rs ss), NatToInt (RLength rs)) => ARec f ss -> ARec f rs
- arecSetSubset :: forall rs ss f. IndexWitnesses (RImage rs ss) => ARec f ss -> ARec f rs -> ARec f ss
Documentation
newtype ARec (f :: k -> *) (ts :: [k]) Source #
An array-backed extensible record with constant-time field access.
((~) Nat i (RIndex k t ts), NatToInt (RIndex k t ts)) => RecElem k (ARec k) t ts i Source # | |
((~) [Nat] is (RImage k rs ss), IndexWitnesses is, NatToInt (RLength k rs)) => RecSubset (k -> *) k (ARec k) rs ss is Source # | |
(AllConstrained k (IndexableField k rs) rs, RecApplicative k rs, Eq (Rec k f rs)) => Eq (ARec k f rs) Source # | |
(AllConstrained k (IndexableField k rs) rs, RecApplicative k rs, Ord (Rec k f rs)) => Ord (ARec k f rs) Source # | |
(AllConstrained k (IndexableField k rs) rs, RecApplicative k rs, Show (Rec k f rs)) => Show (ARec k f rs) Source # | |
class NatToInt (RIndex t ts) => IndexableField ts t Source #
NatToInt (RIndex k t ts) => IndexableField k ts t Source # | |
fromARec :: forall f ts. (RecApplicative ts, AllConstrained (IndexableField ts) ts) => ARec f ts -> Rec f ts Source #
aput :: forall t f ts. NatToInt (RIndex t ts) => f t -> ARec f ts -> ARec f ts Source #
Set a field in an ARec
.
alens :: (Functor g, NatToInt (RIndex t ts)) => (f t -> g (f t)) -> ARec f ts -> g (ARec f ts) Source #
Define a lens for a field of an ARec
.
arecGetSubset :: forall rs ss f. (IndexWitnesses (RImage rs ss), NatToInt (RLength rs)) => ARec f ss -> ARec f rs Source #
Get a subset of a record's fields.
arecSetSubset :: forall rs ss f. 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.