lsql-csv-0.1.0.4: 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 Value, Table, and Column, classes over them, and functions 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 #

A single column of a table

Constructors

Column 

Fields

  • [String]

    The names of the column

  • [Value]

    The values of the column

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 #

The 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]

The names of the table

-> [[String]]

The names of the columns

-> [[Value]]

The rows of the table

-> Table

The result table

Makes a 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 the Column is False. The rows, where the Column is True, are kept.

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

Sorts a Table according to given Columns.

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

Splits a Table into multiple Tables so that rows of Columns at first argument are at each Table the same and the number of Tables is minimal. (factorization)

emptyTable :: Table -> Table Source #

Returns Table with same metadata as the 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 a Column.

showColumn :: Column -> [String] Source #

Converts Column to the list of String from its data.

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

A function for applying a single argument function to a Column

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

A function for applying a two-argument function to two Columns

class Boolable a where Source #

Class for converting a value to a 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 #