lsql-csv-0.1.0.3: A tool for CSV files data querying from the shell with short queries.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Lsql.Csv.Core.Tables

Description

This module contains the definition of Lsql datatypes, their classes, and types Table and Column and functions over them for manipulation of them.

Synopsis

Documentation

data Table Source #

A single table of data

Constructors

Table 

Fields

Instances

Instances details
Show Table Source # 
Instance details

Defined in Lsql.Csv.Core.Tables

Methods

showsPrec :: Int -> Table -> ShowS #

show :: Table -> String #

showList :: [Table] -> ShowS #

data Column Source #

Single column of table

Constructors

Column 

Fields

Instances

Instances details
Show Column Source # 
Instance details

Defined in Lsql.Csv.Core.Tables

Eq Column Source # 
Instance details

Defined in Lsql.Csv.Core.Tables

Methods

(==) :: Column -> Column -> Bool #

(/=) :: Column -> Column -> Bool #

Ord Column Source # 
Instance details

Defined in Lsql.Csv.Core.Tables

data Value Source #

Representation of data in tables

Instances

Instances details
Enum Value Source # 
Instance details

Defined in Lsql.Csv.Core.Tables

Floating Value Source # 
Instance details

Defined in Lsql.Csv.Core.Tables

Num Value Source # 
Instance details

Defined in Lsql.Csv.Core.Tables

Fractional Value Source # 
Instance details

Defined in Lsql.Csv.Core.Tables

Integral Value Source # 
Instance details

Defined in Lsql.Csv.Core.Tables

Real Value Source # 
Instance details

Defined in Lsql.Csv.Core.Tables

Methods

toRational :: Value -> Rational #

RealFrac Value Source # 
Instance details

Defined in Lsql.Csv.Core.Tables

Methods

properFraction :: Integral b => Value -> (b, Value) #

truncate :: Integral b => Value -> b #

round :: Integral b => Value -> b #

ceiling :: Integral b => Value -> b #

floor :: Integral b => Value -> b #

Show Value Source # 
Instance details

Defined in Lsql.Csv.Core.Tables

Methods

showsPrec :: Int -> Value -> ShowS #

show :: Value -> String #

showList :: [Value] -> ShowS #

Eq Value Source # 
Instance details

Defined in Lsql.Csv.Core.Tables

Methods

(==) :: Value -> Value -> Bool #

(/=) :: Value -> Value -> Bool #

Ord Value Source # 
Instance details

Defined in Lsql.Csv.Core.Tables

Methods

compare :: Value -> Value -> Ordering #

(<) :: Value -> Value -> Bool #

(<=) :: Value -> Value -> Bool #

(>) :: Value -> Value -> Bool #

(>=) :: Value -> Value -> Bool #

max :: Value -> Value -> Value #

min :: Value -> Value -> Value #

Boolable Value Source # 
Instance details

Defined in Lsql.Csv.Core.Tables

Methods

getBool :: Value -> Bool Source #

buildTable Source #

Arguments

:: [String]

Names of the table

-> [[String]]

Names of columns

-> [[Value]]

Rows of the table

-> Table

Result table

Makes table out of rows of Value

crossJoinTable :: Table -> Table -> Table Source #

Cross joins two tables into one.

filterTable :: Column -> Table -> Table Source #

Filters out rows, where Column is false. The rows, where Column is true, are kept.

sortTable :: [Column] -> Table -> Table Source #

Sorts the table according to the given columns.

byTable :: [Column] -> Table -> [Table] Source #

Splits the table into multiple tables so that rows of columns at first argument are at each table the same and number of tables is minimal. (factorization)

emptyTable :: Table -> Table Source #

Returns table with same metadata as original table, but no data (no rows).

columnNames :: Table -> [([String], Column)] Source #

Returns pairs of names of Column and Column itself of the table

columnValue :: Column -> [Value] Source #

Returns all values of the Column

showColumn :: Column -> [String] Source #

Converts column to list of string from its data

applyOp :: (Value -> Value) -> Column -> Column Source #

Function for applying single argument function to Column

applyInOp :: (Value -> Value -> Value) -> Column -> Column -> Column Source #

Function for applying two argument function to two Columns

class Boolable a where Source #

Class for converting a value to Bool

Methods

getBool :: a -> Bool Source #

Instances

Instances details
Boolable Value Source # 
Instance details

Defined in Lsql.Csv.Core.Tables

Methods

getBool :: Value -> Bool Source #