Copyright | (c) Adam Conner-Sax 2020 |
---|---|
License | BSD-3-Clause |
Maintainer | adam_conner_sax@yahoo.com |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
This module can be used in-place of Frames.InCore. The pipes functions are all replaced by equivalent streamly functions. Relevant classes and type-families are re-exported for convenience.
Synopsis
- inCoreSoA :: forall m rs. (PrimMonad m, RecVec rs) => SerialT m (Record rs) -> m (Int, Rec ((->) Int :. ElField) rs)
- inCoreAoS :: forall m rs. (PrimMonad m, RecVec rs) => SerialT m (Record rs) -> m (FrameRec rs)
- inCoreAoS' :: forall ss rs m. (PrimMonad m, RecVec rs) => (Rec ((->) Int :. ElField) rs -> Rec ((->) Int :. ElField) ss) -> SerialT m (Record rs) -> m (FrameRec ss)
- inCoreSoA_F :: forall m rs. (PrimMonad m, RecVec rs) => Fold m (Record rs) (Int, Rec ((->) Int :. ElField) rs)
- inCoreAoS_F :: forall m rs. (PrimMonad m, RecVec rs) => Fold m (Record rs) (FrameRec rs)
- inCoreAoS'_F :: forall ss rs m. (PrimMonad m, RecVec rs) => (Rec ((->) Int :. ElField) rs -> Rec ((->) Int :. ElField) ss) -> Fold m (Record rs) (FrameRec ss)
- toAoS :: Int -> Rec (((->) Int :: Type -> Type) :. ElField) rs -> FrameRec rs
- type family VectorFor t :: Type -> Type
- type VectorMFor a = Mutable (VectorFor a)
- type family VectorMs (m :: Type -> Type) (rs :: [(Symbol, Type)]) :: [(Symbol, Type)] where ...
- type family Vectors (rs :: [(Symbol, Type)]) :: [(Symbol, Type)] where ...
- class RecVec (rs :: [(Symbol, Type)]) where
- allocRec :: PrimMonad m => proxy rs -> Int -> m (Record (VectorMs m rs))
- freezeRec :: PrimMonad m => proxy rs -> Int -> Record (VectorMs m rs) -> m (Record (Vectors rs))
- growRec :: PrimMonad m => proxy rs -> Record (VectorMs m rs) -> m (Record (VectorMs m rs))
- writeRec :: PrimMonad m => proxy rs -> Int -> Record (VectorMs m rs) -> Record rs -> m ()
- indexRec :: proxy rs -> Int -> Record (Vectors rs) -> Record rs
- produceRec :: proxy rs -> Record (Vectors rs) -> Rec (((->) Int :: Type -> Type) :. ElField) rs
Documentation
inCoreSoA :: forall m rs. (PrimMonad m, RecVec rs) => SerialT m (Record rs) -> m (Int, Rec ((->) Int :. ElField) rs) Source #
Perform the inCoreSoA_F
fold on a stream of records.
inCoreAoS :: forall m rs. (PrimMonad m, RecVec rs) => SerialT m (Record rs) -> m (FrameRec rs) Source #
Perform the inCoreAoS_F
fold on a stream of records.
inCoreAoS' :: forall ss rs m. (PrimMonad m, RecVec rs) => (Rec ((->) Int :. ElField) rs -> Rec ((->) Int :. ElField) ss) -> SerialT m (Record rs) -> m (FrameRec ss) Source #
Perform the more general AoS fold on a stream of records.
inCoreSoA_F :: forall m rs. (PrimMonad m, RecVec rs) => Fold m (Record rs) (Int, Rec ((->) Int :. ElField) rs) Source #
Fold a stream of Vinyl
records into SoA (Structure-of-Arrays) form.
Here as a streamly
fold, so it may be deployed along with other folds or on only part of a stream.
inCoreAoS_F :: forall m rs. (PrimMonad m, RecVec rs) => Fold m (Record rs) (FrameRec rs) Source #
Fold a stream of Vinyl
records into AoS (Array-of-Structures) form.
inCoreAoS'_F :: forall ss rs m. (PrimMonad m, RecVec rs) => (Rec ((->) Int :. ElField) rs -> Rec ((->) Int :. ElField) ss) -> Fold m (Record rs) (FrameRec ss) Source #
More general AoS fold, allowing for a, possible column changing, transformation of the records while in SoA form.
Re-exports from Frames
toAoS :: Int -> Rec (((->) Int :: Type -> Type) :. ElField) rs -> FrameRec rs #
Convert a structure-of-arrays to an array-of-structures. This can simplify usage of an in-memory representation.
type family VectorFor t :: Type -> Type #
The most efficient vector type for each column data type.
Instances
type VectorFor Bool | |
Defined in Frames.InCore | |
type VectorFor Double | |
Defined in Frames.InCore | |
type VectorFor Float | |
Defined in Frames.InCore | |
type VectorFor Int | |
Defined in Frames.InCore | |
type VectorFor String | |
Defined in Frames.InCore | |
type VectorFor Text | |
Defined in Frames.InCore |
type VectorMFor a = Mutable (VectorFor a) #
The mutable version of VectorFor
a particular type.
type family VectorMs (m :: Type -> Type) (rs :: [(Symbol, Type)]) :: [(Symbol, Type)] where ... #
Mutable vector types for each column in a row.
type family Vectors (rs :: [(Symbol, Type)]) :: [(Symbol, Type)] where ... #
Immutable vector types for each column in a row.
class RecVec (rs :: [(Symbol, Type)]) where #
Tooling to allocate, grow, write to, freeze, and index into records of vectors.
allocRec :: PrimMonad m => proxy rs -> Int -> m (Record (VectorMs m rs)) #
freezeRec :: PrimMonad m => proxy rs -> Int -> Record (VectorMs m rs) -> m (Record (Vectors rs)) #
growRec :: PrimMonad m => proxy rs -> Record (VectorMs m rs) -> m (Record (VectorMs m rs)) #
writeRec :: PrimMonad m => proxy rs -> Int -> Record (VectorMs m rs) -> Record rs -> m () #
indexRec :: proxy rs -> Int -> Record (Vectors rs) -> Record rs #
produceRec :: proxy rs -> Record (Vectors rs) -> Rec (((->) Int :: Type -> Type) :. ElField) rs #
Instances
RecVec ([] :: [(Symbol, Type)]) | |
Defined in Frames.InCore allocRec :: PrimMonad m => proxy [] -> Int -> m (Record (VectorMs m [])) # freezeRec :: PrimMonad m => proxy [] -> Int -> Record (VectorMs m []) -> m (Record (Vectors [])) # growRec :: PrimMonad m => proxy [] -> Record (VectorMs m []) -> m (Record (VectorMs m [])) # writeRec :: PrimMonad m => proxy [] -> Int -> Record (VectorMs m []) -> Record [] -> m () # indexRec :: proxy [] -> Int -> Record (Vectors []) -> Record [] # produceRec :: proxy [] -> Record (Vectors []) -> Rec ((->) Int :. ElField) [] # | |
(MVector (VectorMFor a) a, Vector (VectorFor a) a, KnownSymbol s, RecVec rs) => RecVec ((s :-> a) ': rs) | |
Defined in Frames.InCore allocRec :: PrimMonad m => proxy ((s :-> a) ': rs) -> Int -> m (Record (VectorMs m ((s :-> a) ': rs))) # freezeRec :: PrimMonad m => proxy ((s :-> a) ': rs) -> Int -> Record (VectorMs m ((s :-> a) ': rs)) -> m (Record (Vectors ((s :-> a) ': rs))) # growRec :: PrimMonad m => proxy ((s :-> a) ': rs) -> Record (VectorMs m ((s :-> a) ': rs)) -> m (Record (VectorMs m ((s :-> a) ': rs))) # writeRec :: PrimMonad m => proxy ((s :-> a) ': rs) -> Int -> Record (VectorMs m ((s :-> a) ': rs)) -> Record ((s :-> a) ': rs) -> m () # indexRec :: proxy ((s :-> a) ': rs) -> Int -> Record (Vectors ((s :-> a) ': rs)) -> Record ((s :-> a) ': rs) # produceRec :: proxy ((s :-> a) ': rs) -> Record (Vectors ((s :-> a) ': rs)) -> Rec ((->) Int :. ElField) ((s :-> a) ': rs) # |