Frames-streamly-0.1.0.3: A streamly layer for Frames I/O
Copyright(c) Adam Conner-Sax 2020
LicenseBSD-3-Clause
Maintaineradam_conner_sax@yahoo.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Frames.Streamly.InCore

Description

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

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 :: forall (rs :: [(Symbol, Type)]). 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

Instances details
type VectorFor Bool 
Instance details

Defined in Frames.InCore

type VectorFor Double 
Instance details

Defined in Frames.InCore

type VectorFor Float 
Instance details

Defined in Frames.InCore

type VectorFor Int 
Instance details

Defined in Frames.InCore

type VectorFor String 
Instance details

Defined in Frames.InCore

type VectorFor Text 
Instance details

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.

Equations

VectorMs m ('[] :: [(Symbol, Type)]) = '[] :: [(Symbol, Type)] 
VectorMs m ((s :-> a) ': rs) = (s :-> VectorMFor a (PrimState m) a) ': VectorMs m rs 

type family Vectors (rs :: [(Symbol, Type)]) :: [(Symbol, Type)] where ... #

Immutable vector types for each column in a row.

Equations

Vectors ('[] :: [(Symbol, Type)]) = '[] :: [(Symbol, Type)] 
Vectors ((s :-> a) ': rs) = (s :-> VectorFor a a) ': Vectors rs 

class RecVec (rs :: [(Symbol, Type)]) where #

Tooling to allocate, grow, write to, freeze, and index into records of vectors.

Methods

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

Instances details
RecVec ('[] :: [(Symbol, Type)]) 
Instance details

Defined in Frames.InCore

Methods

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) 
Instance details

Defined in Frames.InCore

Methods

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) #