Safe Haskell | None |
---|---|
Language | Haskell2010 |
- newtype Rec f us = Rec# (Vector Any)
- newtype MRec s f us = MRec# (MVector s Any)
- data RIndex xs x
- mkIndex :: forall n xs. (KnownNat n, n <= (Length xs - 1)) => RIndex xs (xs !! n)
- index :: forall n f xs. KnownNat n => Rec f xs -> f (xs !! n)
- (!) :: Rec f us -> RIndex us u -> f u
- checkIndex :: forall xs f. KnownNat (Length xs) => Rec f xs -> Int -> MaybeSome (RIndex xs)
- checkIndex' :: forall xs f. Rec f xs -> Int -> MaybeSome (RIndex xs)
- splitCons :: Rec f (x ': xs) -> (f x, Rec f xs)
- rappend :: Rec f as -> Rec f bs -> Rec f (as ++ bs)
- rmap :: (forall x. f x -> g x) -> Rec f xs -> Rec g xs
- crmap :: forall c g f xs. AllF c f xs => (forall x. c (f x) => f x -> g x) -> Rec f xs -> Rec g xs
- toVector :: (forall x. f x -> r) -> Rec f xs -> Vector r
- ctoVector :: forall c r f xs. AllF c f xs => (forall x. c (f x) => f x -> r) -> Rec f xs -> Vector r
- fromVectorN :: forall n f x. KnownNat n => Vector (f x) -> Maybe (Rec f (Replicate n x))
- fromVector :: forall f x. Vector (f x) -> Some (Rec f)
- replicate :: forall n f x. KnownNat n => f x -> Rec f (Replicate n x)
- thaw :: PrimMonad m => Rec f us -> m (MRec (PrimState m) f us)
- thaw# :: PrimMonad m => Rec f us -> m (MRec (PrimState m) f us)
- freeze :: PrimMonad m => MRec (PrimState m) f us -> m (Rec f us)
- freeze# :: PrimMonad m => MRec (PrimState m) f us -> m (Rec f us)
- modify :: forall n xs fx f. (fx ~ f (xs !! n), KnownNat n) => (fx -> fx) -> Rec f xs -> Rec f xs
- setAt :: forall n x xs f. KnownNat n => f x -> Rec f xs -> Rec f (SetAt n xs x)
Documentation
A heterogeneous record represented by an untyped vector
A mutable heterogeneous record represented by an untyped mutable vector
A prepared index into a record, allowing fast access
mkIndex :: forall n xs. (KnownNat n, n <= (Length xs - 1)) => RIndex xs (xs !! n) Source #
Construct a statically known index into a record O(1)
index :: forall n f xs. KnownNat n => Rec f xs -> f (xs !! n) Source #
Index into a statically known element of a record O(1)
checkIndex :: forall xs f. KnownNat (Length xs) => Rec f xs -> Int -> MaybeSome (RIndex xs) Source #
Prepare a dynamically known index into a statically known record O(n)
checkIndex' :: forall xs f. Rec f xs -> Int -> MaybeSome (RIndex xs) Source #
Prepare a dynamically known index O(n)
splitCons :: Rec f (x ': xs) -> (f x, Rec f xs) Source #
Split a record into a head element, and the remaining record must be statically known to be nonempty O(1)
rmap :: (forall x. f x -> g x) -> Rec f xs -> Rec g xs Source #
Transform a mutable record in by mapping a natural tranformation. O(n)
crmap :: forall c g f xs. AllF c f xs => (forall x. c (f x) => f x -> g x) -> Rec f xs -> Rec g xs Source #
Transform a record in by mapping a natural tranformation that can make use of the provided constraint. Ex: `crmap @Show (K . show) :: (Rec f xs) -> (MRec (K String) xs)` O(n)
toVector :: (forall x. f x -> r) -> Rec f xs -> Vector r Source #
Convert a record to a vector by mapping to a homogeneous type O(n)
ctoVector :: forall c r f xs. AllF c f xs => (forall x. c (f x) => f x -> r) -> Rec f xs -> Vector r Source #
Convert a record to a vector by mapping to a homogeneous type, making use of provided constraint O(n)
fromVectorN :: forall n f x. KnownNat n => Vector (f x) -> Maybe (Rec f (Replicate n x)) Source #
Convert a vector into a homogeneous record of statically known size O(1)
fromVector :: forall f x. Vector (f x) -> Some (Rec f) Source #
Convert a vector into a homogeneous record with dynamically known size O(n)
replicate :: forall n f x. KnownNat n => f x -> Rec f (Replicate n x) Source #
Create a record of statically known size by replicating a single element O(n)
thaw :: PrimMonad m => Rec f us -> m (MRec (PrimState m) f us) Source #
Copy a record into a fresh mutable record O(n)
thaw# :: PrimMonad m => Rec f us -> m (MRec (PrimState m) f us) Source #
unsafely thaw a record. The original record should no longer be used, but this is not checked O(1)
freeze :: PrimMonad m => MRec (PrimState m) f us -> m (Rec f us) Source #
Copy a mutable record into a fresh record O(n)
freeze# :: PrimMonad m => MRec (PrimState m) f us -> m (Rec f us) Source #
Unsafely freeze a mutable record. The original record should no longer be modified, but this is not checked O(1)