dataframe-core-2.4.0.0: Core data structures for the dataframe library.
Safe HaskellNone
LanguageHaskell2010

DataFrame.Typed.Types

Synopsis

Core phantom-typed wrapper

newtype TypedDataFrame (cols :: [(Symbol, Type)]) Source #

A phantom-typed wrapper over the untyped DataFrame.

The type parameter cols is a type-level list of '(name, ty) pairs that tracks the schema at compile time. All operations delegate to the untyped core at runtime and update the phantom type at compile time.

Constructors

TDF 

Fields

Instances

Instances details
Show (TypedDataFrame cols) Source # 
Instance details

Defined in DataFrame.Typed.Types

ToDataFrame (TypedDataFrame cols) Source # 
Instance details

Defined in DataFrame.Typed.Freeze

Eq (TypedDataFrame cols) Source # 
Instance details

Defined in DataFrame.Typed.Types

Methods

(==) :: TypedDataFrame cols -> TypedDataFrame cols -> Bool #

(/=) :: TypedDataFrame cols -> TypedDataFrame cols -> Bool #

Typed expressions (schema-validated)

newtype TExpr (cols :: [(Symbol, Type)]) a Source #

A typed expression validated against schema cols, producing values of type a.

Unlike the untyped 'Expr a', a TExpr can only be constructed through type-safe combinators (col, lit, arithmetic operations) that verify column references exist in the schema with the correct type.

Use unTExpr to extract the underlying Expr for delegation to the untyped API.

Constructors

TExpr 

Fields

Instances

Instances details
Show a => Show (TExpr cols a) Source #

Shows the underlying expression; the schema phantom is type-level only.

Instance details

Defined in DataFrame.Typed.Types

Methods

showsPrec :: Int -> TExpr cols a -> ShowS #

show :: TExpr cols a -> String #

showList :: [TExpr cols a] -> ShowS #

Lifting untyped expressions into the typed world

type family AsTExpr (cols :: [(Symbol, Type)]) e where ... Source #

The typed counterpart of an untyped expression type for schema cols: AsTExpr cols (Expr r) = TExpr cols r. Lets a result type follow the frame — an Expr over a plain frame becomes a TExpr over a typed one.

Equations

AsTExpr cols (Expr r) = TExpr cols r 

class ToTExpr (cols :: [(Symbol, Type)]) e where Source #

Lift an untyped expression into its TExpr for schema cols.

Methods

toTExpr :: e -> AsTExpr cols e Source #

Instances

Instances details
ToTExpr cols (Expr r) Source # 
Instance details

Defined in DataFrame.Typed.Types

Methods

toTExpr :: Expr r -> AsTExpr cols (Expr r) Source #

Typed sort orders

data TSortOrder (cols :: [(Symbol, Type)]) where Source #

A typed sort order validated against schema cols.

Constructors

Asc :: forall a (cols :: [(Symbol, Type)]). (Columnable a, Ord a) => TExpr cols a -> TSortOrder cols 
Desc :: forall a (cols :: [(Symbol, Type)]). (Columnable a, Ord a) => TExpr cols a -> TSortOrder cols 

Grouped typed dataframe

newtype TypedGrouped (keys :: [Symbol]) (cols :: [(Symbol, Type)]) Source #

A phantom-typed wrapper over GroupedDataFrame.

Constructors

TGD 

Typed aggregation builder (Option B)

data TAgg (keys :: [Symbol]) (cols :: [(Symbol, Type)]) (aggs :: [(Symbol, Type)]) where Source #

Internal aggregation chain. Each cons prepends a Column to the aggs phantom list. End users never construct this directly — they compose as entries with (.) and let aggregate apply the composition to TAggNil.

as @"total"   (F.sum  salary)
  . as @"avg_age" (F.mean age)

Constructors

TAggNil :: forall (keys :: [Symbol]) (cols :: [(Symbol, Type)]). TAgg keys cols ('[] :: [(Symbol, Type)]) 
TAggCons 

Fields

taggToNamedExprs :: forall (keys :: [Symbol]) (cols :: [(Symbol, Type)]) (aggs :: [(Symbol, Type)]). TAgg keys cols aggs -> [NamedExpr] Source #

Extract the runtime NamedExpr list from a TAgg, in declaration order (reversed from the cons-built order).

Re-export These

data These a b Source #

Inline replacement for Data.These.These to keep dataframe-core free of the these package dependency. Only the three constructors and the derived classes are used internally.

Constructors

This a 
That b 
These a b 

Instances

Instances details
Foldable (These a) Source # 
Instance details

Defined in DataFrame.Internal.Types

Methods

fold :: Monoid m => These a m -> m #

foldMap :: Monoid m => (a0 -> m) -> These a a0 -> m #

foldMap' :: Monoid m => (a0 -> m) -> These a a0 -> m #

foldr :: (a0 -> b -> b) -> b -> These a a0 -> b #

foldr' :: (a0 -> b -> b) -> b -> These a a0 -> b #

foldl :: (b -> a0 -> b) -> b -> These a a0 -> b #

foldl' :: (b -> a0 -> b) -> b -> These a a0 -> b #

foldr1 :: (a0 -> a0 -> a0) -> These a a0 -> a0 #

foldl1 :: (a0 -> a0 -> a0) -> These a a0 -> a0 #

toList :: These a a0 -> [a0] #

null :: These a a0 -> Bool #

length :: These a a0 -> Int #

elem :: Eq a0 => a0 -> These a a0 -> Bool #

maximum :: Ord a0 => These a a0 -> a0 #

minimum :: Ord a0 => These a a0 -> a0 #

sum :: Num a0 => These a a0 -> a0 #

product :: Num a0 => These a a0 -> a0 #

Traversable (These a) Source # 
Instance details

Defined in DataFrame.Internal.Types

Methods

traverse :: Applicative f => (a0 -> f b) -> These a a0 -> f (These a b) #

sequenceA :: Applicative f => These a (f a0) -> f (These a a0) #

mapM :: Monad m => (a0 -> m b) -> These a a0 -> m (These a b) #

sequence :: Monad m => These a (m a0) -> m (These a a0) #

Functor (These a) Source # 
Instance details

Defined in DataFrame.Internal.Types

Methods

fmap :: (a0 -> b) -> These a a0 -> These a b #

(<$) :: a0 -> These a b -> These a a0 #

(Read a, Read b) => Read (These a b) Source # 
Instance details

Defined in DataFrame.Internal.Types

(Show a, Show b) => Show (These a b) Source # 
Instance details

Defined in DataFrame.Internal.Types

Methods

showsPrec :: Int -> These a b -> ShowS #

show :: These a b -> String #

showList :: [These a b] -> ShowS #

(Eq a, Eq b) => Eq (These a b) Source # 
Instance details

Defined in DataFrame.Internal.Types

Methods

(==) :: These a b -> These a b -> Bool #

(/=) :: These a b -> These a b -> Bool #

(Ord a, Ord b) => Ord (These a b) Source # 
Instance details

Defined in DataFrame.Internal.Types

Methods

compare :: These a b -> These a b -> Ordering #

(<) :: These a b -> These a b -> Bool #

(<=) :: These a b -> These a b -> Bool #

(>) :: These a b -> These a b -> Bool #

(>=) :: These a b -> These a b -> Bool #

max :: These a b -> These a b -> These a b #

min :: These a b -> These a b -> These a b #