Safe Haskell | None |
---|---|
Language | Haskell2010 |
Frames
Description
User-friendly, type safe, runtime efficient tooling for working with tabular data deserialized from comma-separated values (CSV) files. The type of each row of data is inferred from data, which can then be streamed from disk, or worked with in memory.
Synopsis
- module Data.Readable
- (<+>) :: forall {k} (f :: k -> Type) (as :: [k]) (bs :: [k]). Rec f as -> Rec f bs -> Rec f (as ++ bs)
- data Rec (a :: u -> Type) (b :: [u])
- data ElField (t :: (Symbol, Type))
- rsubset :: forall {k1} k2 (rs :: [k2]) (ss :: [k2]) (f :: k1 -> Type) g record (is :: [Nat]). (RecSubset record rs ss is, Functor g, RecSubsetFCtx record f) => (record f rs -> g (record f rs)) -> record f ss -> g (record f ss)
- rcast :: forall {k1} {k2} (rs :: [k1]) (ss :: [k1]) (f :: k2 -> Type) record (is :: [Nat]). (RecSubset record rs ss is, RecSubsetFCtx record f) => record f ss -> record f rs
- type Field = CoRec Identity
- onCoRec :: forall {k1} {k2} c f (ts :: [k1]) (b :: k2) g. RPureConstrained c ts => (forall (a :: k1). (a ∈ ts, c a) => f a -> g b) -> CoRec f ts -> g b
- onField :: forall c (ts :: [Type]) b. RPureConstrained c ts => (forall a. (a ∈ ts, c a) => a -> b) -> Field ts -> b
- rfield :: forall f a b (s :: Symbol). Functor f => (a -> f b) -> ElField '(s, a) -> f (ElField '(s, b))
- type (:.) (f :: l -> Type) (g :: k -> l) = Compose f g
- module Data.Vinyl.Lens
- type family AllAllSat (cs :: k) (ts :: [k1]) where ...
- class AllSatisfied (cs :: k) (t :: k1)
- type family AllConstrained (c :: u -> Constraint) (ts :: [u]) where ...
- type family RecAll (f :: u -> Type) (rs :: [u]) (c :: Type -> Constraint) where ...
- type family RDelete (r :: a) (rs :: [a]) :: [a] where ...
- type (:->) (a :: Symbol) b = '(a, b)
- pattern Col :: forall (s :: Symbol) t. KnownSymbol s => t -> ElField '(s, t)
- module Frames.ColumnUniverse
- readTable :: forall (m :: Type -> Type) (rs :: [(Symbol, Type)]). (MonadSafe m, ReadRec rs, RMap rs) => FilePath -> Producer (Record rs) m ()
- readTableOpt :: forall (m :: Type -> Type) (rs :: [(Symbol, Type)]). (MonadSafe m, ReadRec rs, RMap rs) => ParserOptions -> FilePath -> Producer (Record rs) m ()
- readTableMaybe :: forall (m :: Type -> Type) (rs :: [(Symbol, Type)]). (MonadSafe m, ReadRec rs, RMap rs) => FilePath -> Producer (Rec (Maybe :. ElField) rs) m ()
- readTableDebug :: forall (m :: Type -> Type) (rs :: [(Symbol, Type)]). (MonadSafe m, ReadRec rs, RMap rs, RecMapMethod ShowCSV (Either Text :. ElField) rs, RecordToList rs) => FilePath -> Producer (Record rs) m ()
- pipeTable :: forall (rs :: [(Symbol, Type)]) (m :: Type -> Type). (ReadRec rs, RMap rs, Monad m) => Pipe [Text] (Record rs) m ()
- pipeTableMaybe :: forall (m :: Type -> Type) (rs :: [(Symbol, Type)]). (Monad m, ReadRec rs, RMap rs) => Pipe [Text] (Rec (Maybe :. ElField) rs) m ()
- module Frames.Exploration
- module Frames.Frame
- inCoreAoS :: forall m (rs :: [(Symbol, Type)]). (PrimMonad m, MonadIO m, MonadMask m, RecVec rs) => Producer (Record rs) (SafeT m) () -> m (FrameRec rs)
- inCoreAoS' :: forall m (rs :: [(Symbol, Type)]) (ss :: [(Symbol, Type)]). (PrimMonad m, MonadIO m, MonadMask m, RecVec rs) => (Rec ((->) Int :. ElField) rs -> Rec ((->) Int :. ElField) ss) -> Producer (Record rs) (SafeT m) () -> m (FrameRec ss)
- inCore :: forall m (rs :: [(Symbol, Type)]) (n :: Type -> Type). (PrimMonad m, MonadIO m, MonadMask m, RecVec rs, Monad n) => Producer (Record rs) (SafeT m) () -> m (Producer (Record rs) n ())
- inCoreSoA :: forall m (rs :: [(Symbol, Type)]). (PrimMonad m, MonadIO m, MonadMask m, RecVec rs) => Producer (Record rs) (SafeT m) () -> m (Int, Rec ((->) Int :. ElField) rs)
- toAoS :: forall (rs :: [(Symbol, Type)]). Int -> Rec ((->) Int :. ElField) rs -> FrameRec rs
- toFrame :: forall f (rs :: [(Symbol, Type)]). (Foldable f, RecVec rs) => f (Record rs) -> Frame (Record rs)
- filterFrame :: forall (rs :: [(Symbol, Type)]). RecVec rs => (Record rs -> Bool) -> FrameRec rs -> FrameRec rs
- module Frames.Joins
- melt :: forall (vs :: [(Symbol, Type)]) (ts :: [(Symbol, Type)]) (ss :: [(Symbol, Type)]) proxy. (vs ⊆ ts, ss ⊆ ts, vs ~ RDeleteAll ss ts, HasLength vs, Disjoint ss ts ~ 'True, ts ≅ (vs ++ ss), ColumnHeaders vs, RowToColumn vs vs) => proxy ss -> FrameRec ts -> FrameRec (ss ++ '["value" :-> CoRec ElField vs])
- meltRow :: forall (vs :: [(Symbol, Type)]) (ts :: [(Symbol, Type)]) (ss :: [(Symbol, Type)]) proxy. (vs ⊆ ts, ss ⊆ ts, vs ~ RDeleteAll ss ts, Disjoint ss ts ~ 'True, ts ≅ (vs ++ ss), ColumnHeaders vs, RowToColumn vs vs) => proxy ss -> Record ts -> [Record (ss ++ '["value" :-> CoRec ElField vs])]
- module Frames.Rec
- module Frames.RecF
- tableTypes :: String -> FilePath -> DecsQ
- tableTypes' :: forall (a :: [Type]) c. (c ~ CoRec ColInfo a, ColumnTypeable c, Semigroup c, RPureConstrained (ShowF ColInfo) a) => RowGen a -> DecsQ
- declareColumn :: Text -> Name -> DecsQ
- module Frames.TypeLevel
- class (MonadCatch m, MonadMask m, MonadIO m, MonadIO (Base m)) => MonadSafe (m :: Type -> Type)
- data SafeT (m :: Type -> Type) r
- runSafeT :: (MonadMask m, MonadIO m) => SafeT m r -> m r
- runSafeP :: forall (m :: Type -> Type) r. (MonadMask m, MonadIO m) => Effect (SafeT m) r -> Effect' m r
- runSafeEffect :: (MonadIO m, MonadMask m) => Effect (SafeT m) r -> m r
- data Text
Documentation
module Data.Readable
(<+>) :: forall {k} (f :: k -> Type) (as :: [k]) (bs :: [k]). Rec f as -> Rec f bs -> Rec f (as ++ bs) infixr 5 #
A shorthand for rappend
.
data Rec (a :: u -> Type) (b :: [u]) #
A record is parameterized by a universe u
, an interpretation f
and a
list of rows rs
. The labels or indices of the record are given by
inhabitants of the kind u
; the type of values at any label r :: u
is
given by its interpretation f r :: *
.
Instances
RecSubset (Rec :: (k -> Type) -> [k] -> Type) ('[] :: [k]) (ss :: [k]) ('[] :: [Nat]) | |||||
Defined in Data.Vinyl.Lens Methods rsubsetC :: forall g (f :: k -> Type). (Functor g, RecSubsetFCtx (Rec :: (k -> Type) -> [k] -> Type) f) => (Rec f ('[] :: [k]) -> g (Rec f ('[] :: [k]))) -> Rec f ss -> g (Rec f ss) # rcastC :: forall (f :: k -> Type). RecSubsetFCtx (Rec :: (k -> Type) -> [k] -> Type) f => Rec f ss -> Rec f ('[] :: [k]) # rreplaceC :: forall (f :: k -> Type). RecSubsetFCtx (Rec :: (k -> Type) -> [k] -> Type) f => Rec f ('[] :: [k]) -> Rec f ss -> Rec f ss # | |||||
(RElem r ss i, RSubset rs ss is) => RecSubset (Rec :: (k -> Type) -> [k] -> Type) (r ': rs :: [k]) (ss :: [k]) (i ': is) | |||||
Defined in Data.Vinyl.Lens Methods rsubsetC :: forall g (f :: k -> Type). (Functor g, RecSubsetFCtx (Rec :: (k -> Type) -> [k] -> Type) f) => (Rec f (r ': rs) -> g (Rec f (r ': rs))) -> Rec f ss -> g (Rec f ss) # rcastC :: forall (f :: k -> Type). RecSubsetFCtx (Rec :: (k -> Type) -> [k] -> Type) f => Rec f ss -> Rec f (r ': rs) # rreplaceC :: forall (f :: k -> Type). RecSubsetFCtx (Rec :: (k -> Type) -> [k] -> Type) f => Rec f (r ': rs) -> Rec f ss -> Rec f ss # | |||||
RecElem (Rec :: (a -> Type) -> [a] -> Type) (r :: a) (r' :: a) (r ': rs :: [a]) (r' ': rs :: [a]) 'Z | |||||
Defined in Data.Vinyl.Lens Methods rlensC :: (Functor g, RecElemFCtx (Rec :: (a -> Type) -> [a] -> Type) f) => (f r -> g (f r')) -> Rec f (r ': rs) -> g (Rec f (r' ': rs)) # rgetC :: (RecElemFCtx (Rec :: (a -> Type) -> [a] -> Type) f, r ~ r') => Rec f (r ': rs) -> f r # rputC :: RecElemFCtx (Rec :: (a -> Type) -> [a] -> Type) f => f r' -> Rec f (r ': rs) -> Rec f (r' ': rs) # | |||||
(RIndex r (s ': rs) ~ 'S i, RecElem (Rec :: (a -> Type) -> [a] -> Type) r r' rs rs' i) => RecElem (Rec :: (a -> Type) -> [a] -> Type) (r :: a) (r' :: a) (s ': rs :: [a]) (s ': rs' :: [a]) ('S i) | |||||
Defined in Data.Vinyl.Lens Methods rlensC :: (Functor g, RecElemFCtx (Rec :: (a -> Type) -> [a] -> Type) f) => (f r -> g (f r')) -> Rec f (s ': rs) -> g (Rec f (s ': rs')) # rgetC :: (RecElemFCtx (Rec :: (a -> Type) -> [a] -> Type) f, r ~ r') => Rec f (s ': rs) -> f r # rputC :: RecElemFCtx (Rec :: (a -> Type) -> [a] -> Type) f => f r' -> Rec f (s ': rs) -> Rec f (s ': rs') # | |||||
(AllCols Grouping rs, Grouping (Record rs), Grouping (ElField (s :-> r)), Grouping r) => Grouping (Record ((s :-> r) ': rs)) Source # | |||||
Grouping (Record ('[] :: [(Symbol, Type)])) Source # | |||||
TestCoercion f => TestCoercion (Rec f :: [u] -> Type) | |||||
Defined in Data.Vinyl.Core | |||||
TestEquality f => TestEquality (Rec f :: [u] -> Type) | |||||
Defined in Data.Vinyl.Core | |||||
(Storable (f r), Storable (Rec f rs)) => Storable (Rec f (r ': rs)) | |||||
Defined in Data.Vinyl.Core Methods sizeOf :: Rec f (r ': rs) -> Int # alignment :: Rec f (r ': rs) -> Int # peekElemOff :: Ptr (Rec f (r ': rs)) -> Int -> IO (Rec f (r ': rs)) # pokeElemOff :: Ptr (Rec f (r ': rs)) -> Int -> Rec f (r ': rs) -> IO () # peekByteOff :: Ptr b -> Int -> IO (Rec f (r ': rs)) # pokeByteOff :: Ptr b -> Int -> Rec f (r ': rs) -> IO () # | |||||
Storable (Rec f ('[] :: [u])) | |||||
Defined in Data.Vinyl.Core Methods sizeOf :: Rec f ('[] :: [u]) -> Int # alignment :: Rec f ('[] :: [u]) -> Int # peekElemOff :: Ptr (Rec f ('[] :: [u])) -> Int -> IO (Rec f ('[] :: [u])) # pokeElemOff :: Ptr (Rec f ('[] :: [u])) -> Int -> Rec f ('[] :: [u]) -> IO () # peekByteOff :: Ptr b -> Int -> IO (Rec f ('[] :: [u])) # pokeByteOff :: Ptr b -> Int -> Rec f ('[] :: [u]) -> IO () # peek :: Ptr (Rec f ('[] :: [u])) -> IO (Rec f ('[] :: [u])) # poke :: Ptr (Rec f ('[] :: [u])) -> Rec f ('[] :: [u]) -> IO () # | |||||
(Monoid (f r), Monoid (Rec f rs)) => Monoid (Rec f (r ': rs)) | |||||
Monoid (Rec f ('[] :: [u])) | |||||
(Semigroup (f r), Semigroup (Rec f rs)) => Semigroup (Rec f (r ': rs)) | |||||
Semigroup (Rec f ('[] :: [u])) | |||||
Generic (Rec f rs) => Generic (Rec f (r ': rs)) | |||||
Defined in Data.Vinyl.Core Associated Types
| |||||
Generic (Rec f ('[] :: [u])) | |||||
Defined in Data.Vinyl.Core Associated Types
| |||||
(RMap rs, ReifyConstraint Show f rs, RecordToList rs) => Show (Rec f rs) | Records may be shown insofar as their points may be shown.
| ||||
NFData (Rec f ('[] :: [u])) Source # | |||||
Defined in Frames.ExtraInstances | |||||
ReifyConstraint NFData f xs => NFData (Rec f xs) | |||||
Defined in Data.Vinyl.Core | |||||
(Eq (f r), Eq (Rec f rs)) => Eq (Rec f (r ': rs)) | |||||
Eq (Rec f ('[] :: [u])) | |||||
(Ord (f r), Ord (Rec f rs)) => Ord (Rec f (r ': rs)) | |||||
Defined in Data.Vinyl.Core Methods compare :: Rec f (r ': rs) -> Rec f (r ': rs) -> Ordering # (<) :: Rec f (r ': rs) -> Rec f (r ': rs) -> Bool # (<=) :: Rec f (r ': rs) -> Rec f (r ': rs) -> Bool # (>) :: Rec f (r ': rs) -> Rec f (r ': rs) -> Bool # (>=) :: Rec f (r ': rs) -> Rec f (r ': rs) -> Bool # max :: Rec f (r ': rs) -> Rec f (r ': rs) -> Rec f (r ': rs) # min :: Rec f (r ': rs) -> Rec f (r ': rs) -> Rec f (r ': rs) # | |||||
Ord (Rec f ('[] :: [u])) | |||||
Defined in Data.Vinyl.Core Methods compare :: Rec f ('[] :: [u]) -> Rec f ('[] :: [u]) -> Ordering # (<) :: Rec f ('[] :: [u]) -> Rec f ('[] :: [u]) -> Bool # (<=) :: Rec f ('[] :: [u]) -> Rec f ('[] :: [u]) -> Bool # (>) :: Rec f ('[] :: [u]) -> Rec f ('[] :: [u]) -> Bool # (>=) :: Rec f ('[] :: [u]) -> Rec f ('[] :: [u]) -> Bool # max :: Rec f ('[] :: [u]) -> Rec f ('[] :: [u]) -> Rec f ('[] :: [u]) # min :: Rec f ('[] :: [u]) -> Rec f ('[] :: [u]) -> Rec f ('[] :: [u]) # | |||||
type RecSubsetFCtx (Rec :: (k -> Type) -> [k] -> Type) (f :: k -> Type) | |||||
Defined in Data.Vinyl.Lens | |||||
type RecSubsetFCtx (Rec :: (k -> Type) -> [k] -> Type) (f :: k -> Type) | |||||
Defined in Data.Vinyl.Lens | |||||
type RecElemFCtx (Rec :: (a -> Type) -> [a] -> Type) (f :: a -> Type) | |||||
Defined in Data.Vinyl.Lens | |||||
type RecElemFCtx (Rec :: (a -> Type) -> [a] -> Type) (f :: a -> Type) | |||||
Defined in Data.Vinyl.Lens | |||||
type Rep (Rec f (r ': rs)) | |||||
Defined in Data.Vinyl.Core type Rep (Rec f (r ': rs)) = C1 ('MetaCons ":&" ('InfixI 'RightAssociative 7) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (f r)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rep (Rec f rs))) | |||||
type Rep (Rec f ('[] :: [u])) | |||||
Defined in Data.Vinyl.Core |
data ElField (t :: (Symbol, Type)) #
A value with a phantom Symbol
label. It is not a
Haskell Functor
, but it is used in many of the same places a
Functor
is used in vinyl.
Morally: newtype ElField (s, t) = Field t But GHC doesn't allow that
Instances
(KnownSymbol s, Storable t) => Storable (ElField '(s, t)) | |||||
Defined in Data.Vinyl.Functor Methods sizeOf :: ElField '(s, t) -> Int # alignment :: ElField '(s, t) -> Int # peekElemOff :: Ptr (ElField '(s, t)) -> Int -> IO (ElField '(s, t)) # pokeElemOff :: Ptr (ElField '(s, t)) -> Int -> ElField '(s, t) -> IO () # peekByteOff :: Ptr b -> Int -> IO (ElField '(s, t)) # pokeByteOff :: Ptr b -> Int -> ElField '(s, t) -> IO () # | |||||
(KnownSymbol s, Monoid t) => Monoid (ElField '(s, t)) | |||||
Semigroup t => Semigroup (ElField '(s, t)) | |||||
(Floating t, KnownSymbol s) => Floating (ElField '(s, t)) | |||||
Defined in Data.Vinyl.Functor Methods exp :: ElField '(s, t) -> ElField '(s, t) # log :: ElField '(s, t) -> ElField '(s, t) # sqrt :: ElField '(s, t) -> ElField '(s, t) # (**) :: ElField '(s, t) -> ElField '(s, t) -> ElField '(s, t) # logBase :: ElField '(s, t) -> ElField '(s, t) -> ElField '(s, t) # sin :: ElField '(s, t) -> ElField '(s, t) # cos :: ElField '(s, t) -> ElField '(s, t) # tan :: ElField '(s, t) -> ElField '(s, t) # asin :: ElField '(s, t) -> ElField '(s, t) # acos :: ElField '(s, t) -> ElField '(s, t) # atan :: ElField '(s, t) -> ElField '(s, t) # sinh :: ElField '(s, t) -> ElField '(s, t) # cosh :: ElField '(s, t) -> ElField '(s, t) # tanh :: ElField '(s, t) -> ElField '(s, t) # asinh :: ElField '(s, t) -> ElField '(s, t) # acosh :: ElField '(s, t) -> ElField '(s, t) # atanh :: ElField '(s, t) -> ElField '(s, t) # log1p :: ElField '(s, t) -> ElField '(s, t) # expm1 :: ElField '(s, t) -> ElField '(s, t) # | |||||
KnownSymbol s => Generic (ElField '(s, a)) | |||||
(Num t, KnownSymbol s) => Num (ElField '(s, t)) | |||||
Defined in Data.Vinyl.Functor Methods (+) :: ElField '(s, t) -> ElField '(s, t) -> ElField '(s, t) # (-) :: ElField '(s, t) -> ElField '(s, t) -> ElField '(s, t) # (*) :: ElField '(s, t) -> ElField '(s, t) -> ElField '(s, t) # negate :: ElField '(s, t) -> ElField '(s, t) # abs :: ElField '(s, t) -> ElField '(s, t) # signum :: ElField '(s, t) -> ElField '(s, t) # fromInteger :: Integer -> ElField '(s, t) # | |||||
(Fractional t, KnownSymbol s) => Fractional (ElField '(s, t)) | |||||
(Real t, KnownSymbol s) => Real (ElField '(s, t)) | |||||
Defined in Data.Vinyl.Functor Methods toRational :: ElField '(s, t) -> Rational # | |||||
(RealFrac t, KnownSymbol s) => RealFrac (ElField '(s, t)) | |||||
(Show t, KnownSymbol s) => Show (ElField '(s, t)) | |||||
NFData a => NFData (ElField (s :-> a)) Source # | |||||
Defined in Frames.ExtraInstances | |||||
(AllCols Grouping rs, Grouping (Record rs), Grouping (ElField (s :-> r)), Grouping r) => Grouping (Record ((s :-> r) ': rs)) Source # | |||||
Grouping (Record ('[] :: [(Symbol, Type)])) Source # | |||||
Grouping a => Grouping (ElField (s :-> a)) Source # | |||||
Eq t => Eq (ElField '(s, t)) | |||||
Ord t => Ord (ElField '(s, t)) | |||||
Defined in Data.Vinyl.Functor Methods compare :: ElField '(s, t) -> ElField '(s, t) -> Ordering # (<) :: ElField '(s, t) -> ElField '(s, t) -> Bool # (<=) :: ElField '(s, t) -> ElField '(s, t) -> Bool # (>) :: ElField '(s, t) -> ElField '(s, t) -> Bool # (>=) :: ElField '(s, t) -> ElField '(s, t) -> Bool # max :: ElField '(s, t) -> ElField '(s, t) -> ElField '(s, t) # min :: ElField '(s, t) -> ElField '(s, t) -> ElField '(s, t) # | |||||
KnownSymbol s => IsoHKD ElField ('(s, a) :: (Symbol, Type)) | Work with values of type | ||||
(i ~ RIndex t ts, NatToInt i, FieldOffset ElField ts t, Storable (Rec ElField ts), AllConstrained (FieldOffset ElField ts) ts) => RecElem (SRec2 ElField) (t :: (Symbol, Type)) (t :: (Symbol, Type)) (ts :: [(Symbol, Type)]) (ts :: [(Symbol, Type)]) i | Field accessors for | ||||
Defined in Data.Vinyl.SRec Associated Types
| |||||
(is ~ RImage rs ss, RecSubset (Rec :: ((Symbol, Type) -> Type) -> [(Symbol, Type)] -> Type) rs ss is, Storable (Rec ElField rs), Storable (Rec ElField ss), RPureConstrained (FieldOffset ElField ss) rs, RPureConstrained (FieldOffset ElField rs) rs, RFoldMap rs, RMap rs, RApply rs) => RecSubset (SRec2 ElField) (rs :: [(Symbol, Type)]) (ss :: [(Symbol, Type)]) is | |||||
Defined in Data.Vinyl.SRec Associated Types
Methods rsubsetC :: forall g (f :: (Symbol, Type) -> Type). (Functor g, RecSubsetFCtx (SRec2 ElField) f) => (SRec2 ElField f rs -> g (SRec2 ElField f rs)) -> SRec2 ElField f ss -> g (SRec2 ElField f ss) # rcastC :: forall (f :: (Symbol, Type) -> Type). RecSubsetFCtx (SRec2 ElField) f => SRec2 ElField f ss -> SRec2 ElField f rs # rreplaceC :: forall (f :: (Symbol, Type) -> Type). RecSubsetFCtx (SRec2 ElField) f => SRec2 ElField f rs -> SRec2 ElField f ss -> SRec2 ElField f ss # | |||||
type Rep (ElField '(s, a)) | |||||
type HKD ElField ('(s, a) :: (Symbol, Type)) | |||||
Defined in Data.Vinyl.XRec | |||||
type RecElemFCtx (SRec2 ElField) (f :: (Symbol, Type) -> Type) | |||||
Defined in Data.Vinyl.SRec | |||||
type RecSubsetFCtx (SRec2 ElField) (f :: (Symbol, Type) -> Type) | |||||
Defined in Data.Vinyl.SRec |
rsubset :: forall {k1} k2 (rs :: [k2]) (ss :: [k2]) (f :: k1 -> Type) g record (is :: [Nat]). (RecSubset record rs ss is, Functor g, RecSubsetFCtx record f) => (record f rs -> g (record f rs)) -> record f ss -> g (record f ss) #
A lens into a slice of the larger record. This is rsubsetC
with
the type arguments reordered for more convenient usage with
TypeApplications
.
rcast :: forall {k1} {k2} (rs :: [k1]) (ss :: [k1]) (f :: k2 -> Type) record (is :: [Nat]). (RecSubset record rs ss is, RecSubsetFCtx record f) => record f ss -> record f rs #
Takes a larger record to a smaller one by forgetting fields. This
is rcastC
with the type arguments reordered for more convenient
usage with TypeApplications
.
onCoRec :: forall {k1} {k2} c f (ts :: [k1]) (b :: k2) g. RPureConstrained c ts => (forall (a :: k1). (a ∈ ts, c a) => f a -> g b) -> CoRec f ts -> g b #
Apply methods from a type class to a CoRec
. Intended for use
with TypeApplications
, e.g. onCoRec @Show show r
onField :: forall c (ts :: [Type]) b. RPureConstrained c ts => (forall a. (a ∈ ts, c a) => a -> b) -> Field ts -> b #
Apply a type class method to a Field
. Intended for use with
TypeApplications
, e.g. onField @Show show r
.
rfield :: forall f a b (s :: Symbol). Functor f => (a -> f b) -> ElField '(s, a) -> f (ElField '(s, b)) #
Lens for an ElField'
s data payload.
module Data.Vinyl.Lens
type family AllAllSat (cs :: k) (ts :: [k1]) where ... #
Constraint that all types in a type-level list satisfy each constraint from a list of constraints.
AllAllSat cs ts
should be equivalent to AllConstrained
(AllSatisfied cs) ts
if partial application of type families were
legal.
Equations
AllAllSat (cs :: k1) ('[] :: [k2]) = () | |
AllAllSat (cs :: k1) (t ': ts :: [k2]) = (AllSatisfied cs t, AllAllSat cs ts) |
class AllSatisfied (cs :: k) (t :: k1) #
Constraint that each Constraint in a type-level list is satisfied by a particular type.
Instances
AllSatisfied ('[] :: [a]) (t :: k) | |
Defined in Data.Vinyl.TypeLevel | |
(c t, AllSatisfied cs t) => AllSatisfied (c ': cs :: [k -> Constraint]) (t :: k) | |
Defined in Data.Vinyl.TypeLevel |
type family AllConstrained (c :: u -> Constraint) (ts :: [u]) where ... #
Constraint that all types in a type-level list satisfy a constraint.
Equations
AllConstrained (c :: u -> Constraint) ('[] :: [u]) = () | |
AllConstrained (c :: u -> Constraint) (t ': ts :: [u]) = (c t, AllConstrained c ts) |
type family RecAll (f :: u -> Type) (rs :: [u]) (c :: Type -> Constraint) where ... #
A constraint-former which applies to every field in a record.
type family RDelete (r :: a) (rs :: [a]) :: [a] where ... #
Remove the first occurrence of a type from a type-level list.
module Frames.ColumnUniverse
readTable :: forall (m :: Type -> Type) (rs :: [(Symbol, Type)]). (MonadSafe m, ReadRec rs, RMap rs) => FilePath -> Producer (Record rs) m () Source #
Returns a producer of rows for which each column was successfully parsed.
readTableOpt :: forall (m :: Type -> Type) (rs :: [(Symbol, Type)]). (MonadSafe m, ReadRec rs, RMap rs) => ParserOptions -> FilePath -> Producer (Record rs) m () Source #
Returns a producer of rows for which each column was successfully parsed.
readTableMaybe :: forall (m :: Type -> Type) (rs :: [(Symbol, Type)]). (MonadSafe m, ReadRec rs, RMap rs) => FilePath -> Producer (Rec (Maybe :. ElField) rs) m () Source #
Produce rows where any given entry can fail to parse.
readTableDebug :: forall (m :: Type -> Type) (rs :: [(Symbol, Type)]). (MonadSafe m, ReadRec rs, RMap rs, RecMapMethod ShowCSV (Either Text :. ElField) rs, RecordToList rs) => FilePath -> Producer (Record rs) m () Source #
Similar to readTable
except that rows that fail to parse are
printed to stderr
with columns that failed to parse printed as
"Left rawtext"
while those that were successfully parsed are
shown as "Right text"
.
pipeTable :: forall (rs :: [(Symbol, Type)]) (m :: Type -> Type). (ReadRec rs, RMap rs, Monad m) => Pipe [Text] (Record rs) m () Source #
Pipe lines of CSV text into rows for which each column was successfully parsed.
pipeTableMaybe :: forall (m :: Type -> Type) (rs :: [(Symbol, Type)]). (Monad m, ReadRec rs, RMap rs) => Pipe [Text] (Rec (Maybe :. ElField) rs) m () Source #
Stream lines of CSV data into rows of ’Rec’ values where any given entry can fail to parse.
module Frames.Exploration
module Frames.Frame
inCoreAoS :: forall m (rs :: [(Symbol, Type)]). (PrimMonad m, MonadIO m, MonadMask m, RecVec rs) => Producer (Record rs) (SafeT m) () -> m (FrameRec rs) Source #
Stream a finite sequence of rows into an efficient in-memory
representation for further manipulation. Each column of the input
table will be stored optimally based on its type, making use of the
resulting generators a matter of indexing into a densely packed
representation. Returns a Frame
that provides a function to index
into the table.
inCoreAoS' :: forall m (rs :: [(Symbol, Type)]) (ss :: [(Symbol, Type)]). (PrimMonad m, MonadIO m, MonadMask m, RecVec rs) => (Rec ((->) Int :. ElField) rs -> Rec ((->) Int :. ElField) ss) -> Producer (Record rs) (SafeT m) () -> m (FrameRec ss) Source #
inCore :: forall m (rs :: [(Symbol, Type)]) (n :: Type -> Type). (PrimMonad m, MonadIO m, MonadMask m, RecVec rs, Monad n) => Producer (Record rs) (SafeT m) () -> m (Producer (Record rs) n ()) Source #
Stream a finite sequence of rows into an efficient in-memory representation for further manipulation. Each column of the input table will be stored optimally based on its type, making use of the resulting generator a matter of indexing into a densely packed representation.
inCoreSoA :: forall m (rs :: [(Symbol, Type)]). (PrimMonad m, MonadIO m, MonadMask m, RecVec rs) => Producer (Record rs) (SafeT m) () -> m (Int, Rec ((->) Int :. ElField) rs) Source #
Stream a finite sequence of rows into an efficient in-memory
representation for further manipulation. Each column of the input
table will be stored optimally based on its type, making use of the
resulting generators a matter of indexing into a densely packed
representation. Returns the number of rows and a record of column
indexing functions. See toAoS
to convert the result to a Frame
which provides an easier-to-use function that indexes into the
table in a row-major fashion.
toAoS :: forall (rs :: [(Symbol, Type)]). Int -> Rec ((->) Int :. ElField) rs -> FrameRec rs Source #
Convert a structure-of-arrays to an array-of-structures. This can simplify usage of an in-memory representation.
toFrame :: forall f (rs :: [(Symbol, Type)]). (Foldable f, RecVec rs) => f (Record rs) -> Frame (Record rs) Source #
filterFrame :: forall (rs :: [(Symbol, Type)]). RecVec rs => (Record rs -> Bool) -> FrameRec rs -> FrameRec rs Source #
Keep only those rows of a FrameRec
that satisfy a predicate.
module Frames.Joins
melt :: forall (vs :: [(Symbol, Type)]) (ts :: [(Symbol, Type)]) (ss :: [(Symbol, Type)]) proxy. (vs ⊆ ts, ss ⊆ ts, vs ~ RDeleteAll ss ts, HasLength vs, Disjoint ss ts ~ 'True, ts ≅ (vs ++ ss), ColumnHeaders vs, RowToColumn vs vs) => proxy ss -> FrameRec ts -> FrameRec (ss ++ '["value" :-> CoRec ElField vs]) Source #
meltRow :: forall (vs :: [(Symbol, Type)]) (ts :: [(Symbol, Type)]) (ss :: [(Symbol, Type)]) proxy. (vs ⊆ ts, ss ⊆ ts, vs ~ RDeleteAll ss ts, Disjoint ss ts ~ 'True, ts ≅ (vs ++ ss), ColumnHeaders vs, RowToColumn vs vs) => proxy ss -> Record ts -> [Record (ss ++ '["value" :-> CoRec ElField vs])] Source #
Like melt
in the reshape2
package for the R
language. It
stacks multiple columns into a single column over multiple
rows. Takes a specification of the id columns that remain
unchanged. The remaining columns will be stacked.
Suppose we have a record, r :: Record [Name,Age,Weight]
. If we
apply melt [pr1|Name|] r
, we get two values with type Record
[Name, "value" :-> CoRec Identity [Age,Weight]]
. The first will
contain Age
in the value
column, and the second will contain
Weight
in the value
column.
module Frames.Rec
module Frames.RecF
tableTypes :: String -> FilePath -> DecsQ Source #
Generate types for a row of a table. This will be something like
Record ["x" :-> a, "y" :-> b, "z" :-> c]
. This splice
additionally generates a type synonym for each column, and a proxy
value of that type. If the CSV file has column names "foo",
"bar", and "baz", then this will declare type Foo = "foo" :->
Int
, for example, foo = rlens @Foo
, and foo' = rlens' @Foo
.
See tableTypes'
if you need to customize parsing to do things
like override the separator character (default is a single comma),
or supply column names.
tableTypes' :: forall (a :: [Type]) c. (c ~ CoRec ColInfo a, ColumnTypeable c, Semigroup c, RPureConstrained (ShowF ColInfo) a) => RowGen a -> DecsQ Source #
Generate a type for a row of a table. This will be something like
Record ["x" :-> a, "y" :-> b, "z" :-> c]
. Additionally generates
a type synonym for each column, and a proxy value of that type. If
the CSV file has column names "foo", "bar", and "baz", then
this will declare type Foo = "foo" :-> Int
, for example, foo =
rlens @Foo
, and foo' = rlens' @Foo
.
The supplied RowGen
value is also used to produce a value of type
ParserOptions
that can be passed to functions like
readTableOpt
. This is useful if you need to customize parsing to
support something like a special separator string. This value of
type ParserOptions
will be given a name based on the row type
name. If the row type is Row
, then thsi splice will generate a
value rowParser :: ParserOptions
.
declareColumn :: Text -> Name -> DecsQ Source #
Splice for manually declaring a column of a given type. For
example, declareColumn "x2" ''Double
will declare a type synonym
type X2 = "x2" :-> Double
and a lens x2
.
module Frames.TypeLevel
class (MonadCatch m, MonadMask m, MonadIO m, MonadIO (Base m)) => MonadSafe (m :: Type -> Type) #
Instances
MonadSafe m => MonadSafe (CatchT m) | |||||
(MonadIO m, MonadCatch m, MonadMask m) => MonadSafe (SafeT m) | |||||
MonadSafe m => MonadSafe (IdentityT m) | |||||
MonadSafe m => MonadSafe (ReaderT i m) | |||||
MonadSafe m => MonadSafe (StateT s m) | |||||
MonadSafe m => MonadSafe (StateT s m) | |||||
(MonadSafe m, Monoid w) => MonadSafe (WriterT w m) | |||||
(MonadSafe m, Monoid w) => MonadSafe (WriterT w m) | |||||
(MonadSafe m, Monoid w) => MonadSafe (RWST i w s m) | |||||
(MonadSafe m, Monoid w) => MonadSafe (RWST i w s m) | |||||
MonadSafe m => MonadSafe (Proxy a' a b' b m) | |||||
Defined in Pipes.Safe Associated Types
|
data SafeT (m :: Type -> Type) r #
SafeT
is a monad transformer that extends the base monad with the ability
to register
and release
finalizers.
All unreleased finalizers are called at the end of the SafeT
block, even
in the event of exceptions.
Instances
runSafeT :: (MonadMask m, MonadIO m) => SafeT m r -> m r #
Run the SafeT
monad transformer, executing all unreleased finalizers at
the end of the computation
runSafeP :: forall (m :: Type -> Type) r. (MonadMask m, MonadIO m) => Effect (SafeT m) r -> Effect' m r #
runSafeEffect :: (MonadIO m, MonadMask m) => Effect (SafeT m) r -> m r Source #
Run a self-contained ’Pipes.Effect’ and execute the finalizers associated with the ’SafeT’ transformer.