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

DataFrame.Internal.Expression

Synopsis

Documentation

class Typeable op => UnaryOp (op :: Type -> Type -> Type) where Source #

Operators are an open typeclass: built-ins get their own Typeable type so the simplifier can match them by cast, and users can add instances. The generic UnUDF/BinUDF carriers cover UDFs, dynamic-named, and arithmetic ops.

Minimal complete definition

unaryFn, unaryName

Methods

unaryFn :: op a b -> a -> b Source #

unaryName :: op a b -> Text Source #

unarySymbol :: op a b -> Maybe Text Source #

Instances

Instances details
UnaryOp UnUDF Source # 
Instance details

Defined in DataFrame.Internal.Expression

Methods

unaryFn :: UnUDF a b -> a -> b Source #

unaryName :: UnUDF a b -> Text Source #

unarySymbol :: UnUDF a b -> Maybe Text Source #

class Typeable op => BinaryOp (op :: Type -> Type -> Type -> Type) where Source #

Minimal complete definition

binaryFn, binaryName

Methods

binaryFn :: op a b c -> a -> b -> c Source #

binaryName :: op a b c -> Text Source #

binarySymbol :: op a b c -> Maybe Text Source #

binaryCommutative :: op a b c -> Bool Source #

binaryPrecedence :: op a b c -> Int Source #

Instances

Instances details
BinaryOp BinUDF Source # 
Instance details

Defined in DataFrame.Internal.Expression

Methods

binaryFn :: BinUDF a b c -> a -> b -> c Source #

binaryName :: BinUDF a b c -> Text Source #

binarySymbol :: BinUDF a b c -> Maybe Text Source #

binaryCommutative :: BinUDF a b c -> Bool Source #

binaryPrecedence :: BinUDF a b c -> Int Source #

BinaryOp NullAnd Source # 
Instance details

Defined in DataFrame.Operators

BinaryOp NullEq Source # 
Instance details

Defined in DataFrame.Operators

Methods

binaryFn :: NullEq a b c -> a -> b -> c Source #

binaryName :: NullEq a b c -> Text Source #

binarySymbol :: NullEq a b c -> Maybe Text Source #

binaryCommutative :: NullEq a b c -> Bool Source #

binaryPrecedence :: NullEq a b c -> Int Source #

BinaryOp NullGeq Source # 
Instance details

Defined in DataFrame.Operators

BinaryOp NullGt Source # 
Instance details

Defined in DataFrame.Operators

Methods

binaryFn :: NullGt a b c -> a -> b -> c Source #

binaryName :: NullGt a b c -> Text Source #

binarySymbol :: NullGt a b c -> Maybe Text Source #

binaryCommutative :: NullGt a b c -> Bool Source #

binaryPrecedence :: NullGt a b c -> Int Source #

BinaryOp NullLeq Source # 
Instance details

Defined in DataFrame.Operators

BinaryOp NullLt Source # 
Instance details

Defined in DataFrame.Operators

Methods

binaryFn :: NullLt a b c -> a -> b -> c Source #

binaryName :: NullLt a b c -> Text Source #

binarySymbol :: NullLt a b c -> Maybe Text Source #

binaryCommutative :: NullLt a b c -> Bool Source #

binaryPrecedence :: NullLt a b c -> Int Source #

BinaryOp NullNeq Source # 
Instance details

Defined in DataFrame.Operators

BinaryOp NullOr Source # 
Instance details

Defined in DataFrame.Operators

Methods

binaryFn :: NullOr a b c -> a -> b -> c Source #

binaryName :: NullOr a b c -> Text Source #

binarySymbol :: NullOr a b c -> Maybe Text Source #

binaryCommutative :: NullOr a b c -> Bool Source #

binaryPrecedence :: NullOr a b c -> Int Source #

data UnUDF a b Source #

Constructors

MkUnaryOp 

Fields

Instances

Instances details
UnaryOp UnUDF Source # 
Instance details

Defined in DataFrame.Internal.Expression

Methods

unaryFn :: UnUDF a b -> a -> b Source #

unaryName :: UnUDF a b -> Text Source #

unarySymbol :: UnUDF a b -> Maybe Text Source #

data BinUDF a b c Source #

Constructors

MkBinaryOp 

Instances

Instances details
BinaryOp BinUDF Source # 
Instance details

Defined in DataFrame.Internal.Expression

Methods

binaryFn :: BinUDF a b c -> a -> b -> c Source #

binaryName :: BinUDF a b c -> Text Source #

binarySymbol :: BinUDF a b c -> Maybe Text Source #

binaryCommutative :: BinUDF a b c -> Bool Source #

binaryPrecedence :: BinUDF a b c -> Int Source #

data MeanAcc Source #

Constructors

MeanAcc !Double !Int 

data AggStrategy a b where Source #

Constructors

CollectAgg :: forall (v :: Type -> Type) b a. (Vector v b, Typeable v) => Text -> (v b -> a) -> AggStrategy a b 
FoldAgg :: forall a b. Text -> Maybe a -> (a -> b -> a) -> AggStrategy a b 
MergeAgg :: forall acc b a. Columnable acc => Text -> acc -> (acc -> b -> acc) -> (acc -> acc -> acc) -> (acc -> a) -> AggStrategy a b 

data Expr a where Source #

Constructors

Col :: forall a. Columnable a => Text -> Expr a 
CastWith :: forall a1 a. (Columnable a1, Columnable a, Read a1) => Text -> Text -> (Either String a1 -> a) -> Expr a 
CastExprWith :: forall a1 a src. (Columnable a1, Columnable a, Columnable src, Read a1) => Text -> (Either String a1 -> a) -> Expr src -> Expr a 
Lit :: forall a. Columnable a => a -> Expr a 
Unary :: forall (op :: Type -> Type -> Type) a b. (UnaryOp op, Columnable a, Columnable b) => op b a -> Expr b -> Expr a 
Binary :: forall (op :: Type -> Type -> Type -> Type) c b a. (BinaryOp op, Columnable c, Columnable b, Columnable a) => op c b a -> Expr c -> Expr b -> Expr a 
If :: forall a. Columnable a => Expr Bool -> Expr a -> Expr a -> Expr a 
Agg :: forall a b. (Columnable a, Columnable b) => AggStrategy a b -> Expr b -> Expr a 
Over :: forall a. Columnable a => [Text] -> Expr a -> Expr a 

Instances

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

Defined in DataFrame.Typed.Types

Methods

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

(IsString a, Columnable a) => IsString (Expr a) Source # 
Instance details

Defined in DataFrame.Internal.Expression

Methods

fromString :: String -> Expr a #

(Floating a, Columnable a) => Floating (Expr a) Source # 
Instance details

Defined in DataFrame.Internal.Expression

Methods

pi :: Expr a #

exp :: Expr a -> Expr a #

log :: Expr a -> Expr a #

sqrt :: Expr a -> Expr a #

(**) :: Expr a -> Expr a -> Expr a #

logBase :: Expr a -> Expr a -> Expr a #

sin :: Expr a -> Expr a #

cos :: Expr a -> Expr a #

tan :: Expr a -> Expr a #

asin :: Expr a -> Expr a #

acos :: Expr a -> Expr a #

atan :: Expr a -> Expr a #

sinh :: Expr a -> Expr a #

cosh :: Expr a -> Expr a #

tanh :: Expr a -> Expr a #

asinh :: Expr a -> Expr a #

acosh :: Expr a -> Expr a #

atanh :: Expr a -> Expr a #

log1p :: Expr a -> Expr a #

expm1 :: Expr a -> Expr a #

log1pexp :: Expr a -> Expr a #

log1mexp :: Expr a -> Expr a #

(Num a, Columnable a) => Num (Expr a) Source # 
Instance details

Defined in DataFrame.Internal.Expression

Methods

(+) :: Expr a -> Expr a -> Expr a #

(-) :: Expr a -> Expr a -> Expr a #

(*) :: Expr a -> Expr a -> Expr a #

negate :: Expr a -> Expr a #

abs :: Expr a -> Expr a #

signum :: Expr a -> Expr a #

fromInteger :: Integer -> Expr a #

(Fractional a, Columnable a) => Fractional (Expr a) Source # 
Instance details

Defined in DataFrame.Internal.Expression

Methods

(/) :: Expr a -> Expr a -> Expr a #

recip :: Expr a -> Expr a #

fromRational :: Rational -> Expr a #

Show a => Show (Expr a) Source # 
Instance details

Defined in DataFrame.Internal.Expression

Methods

showsPrec :: Int -> Expr a -> ShowS #

show :: Expr a -> String #

showList :: [Expr a] -> ShowS #

data UExpr where Source #

Constructors

UExpr :: forall a. Columnable a => Expr a -> UExpr 

Instances

Instances details
Show UExpr Source # 
Instance details

Defined in DataFrame.Internal.Expression

Methods

showsPrec :: Int -> UExpr -> ShowS #

show :: UExpr -> String #

showList :: [UExpr] -> ShowS #

add :: (Num a, Columnable a) => Expr a -> Expr a -> Expr a Source #

sub :: (Num a, Columnable a) => Expr a -> Expr a -> Expr a Source #

mult :: (Num a, Columnable a) => Expr a -> Expr a -> Expr a Source #

divide :: (Fractional a, Columnable a) => Expr a -> Expr a -> Expr a Source #

normalize :: (Show a, Typeable a) => Expr a -> Expr a Source #

eqExpr :: Columnable a => Expr a -> Expr a -> Bool Source #

substituteColumns :: Columnable a => Map Text UExpr -> Expr a -> Expr a Source #

Simultaneously substitute Col references from a name→expression map in a single parallel pass, so a swap like {a ↦ col b, b ↦ col a} works. Raw-text references (in CastWith, Over keys) are left untouched; type mismatch raises.

prettyPrint :: Expr a -> String Source #

Render an expression as readable, width-aware pseudo-code at the default width (defaultWidth). See prettyPrintWidth to control wrapping.

prettyPrintWidth :: Int -> Expr a -> String Source #

Render an expression as readable, width-aware pseudo-code: long binary chains wrap onto aligned continuation lines, ifthenelse break onto their own lines (nested else if form a flat ladder), and sub-exprs are parenthesized by precedence.