-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A tool for CSV files data querying from the shell with short queries. -- -- lsql-csv is a tool for small CSV file data querying from a shell with -- short queries. It makes it possible to work with small CSV files like -- with a read-only relational databases. The tool implements a new -- language LSQL similar to SQL, specifically designed for working with -- CSV files in a shell. @package lsql-csv @version 0.1.0.4 -- | This module contains the definition of Value, Table, and -- Column, classes over them, and functions for manipulation of -- them. module Lsql.Csv.Core.Tables -- | A single table of data data Table Table :: [String] -> [Column] -> Table -- | A single column of a table data Column Column :: [String] -> [Value] -> Column -- | The representation of data in Tables data Value IntValue :: Int -> Value StringValue :: String -> Value DoubleValue :: Double -> Value BoolValue :: Bool -> Value -- | Makes a table out of rows of Value. buildTable :: [String] -> [[String]] -> [[Value]] -> Table -- | Cross joins two Tables into one. crossJoinTable :: Table -> Table -> Table -- | Filters out rows, where the Column is False. The rows, -- where the Column is True, are kept. filterTable :: Column -> Table -> Table -- | Sorts a Table according to given Columns. sortTable :: [Column] -> Table -> Table -- | 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) byTable :: [Column] -> Table -> [Table] -- | Returns Table with same metadata as the original Table, -- but no data (no rows). emptyTable :: Table -> Table -- | Returns pairs of names of Column and Column itself of -- the table. columnNames :: Table -> [([String], Column)] -- | Returns all values of a Column. columnValue :: Column -> [Value] -- | Converts Column to the list of String from its data. showColumn :: Column -> [String] -- | A function for applying a single argument function to a Column applyOp :: (Value -> Value) -> Column -> Column -- | A function for applying a two-argument function to two Columns applyInOp :: (Value -> Value -> Value) -> Column -> Column -> Column -- | Class for converting a value to a Bool class Boolable a getBool :: Boolable a => a -> Bool instance GHC.Show.Show Lsql.Csv.Core.Tables.Table instance GHC.Classes.Eq Lsql.Csv.Core.Tables.Column instance GHC.Classes.Ord Lsql.Csv.Core.Tables.Column instance GHC.Show.Show Lsql.Csv.Core.Tables.Column instance Lsql.Csv.Core.Tables.Boolable Lsql.Csv.Core.Tables.Value instance GHC.Classes.Ord Lsql.Csv.Core.Tables.Value instance GHC.Classes.Eq Lsql.Csv.Core.Tables.Value instance GHC.Real.Real Lsql.Csv.Core.Tables.Value instance GHC.Real.RealFrac Lsql.Csv.Core.Tables.Value instance GHC.Enum.Enum Lsql.Csv.Core.Tables.Value instance GHC.Real.Integral Lsql.Csv.Core.Tables.Value instance GHC.Num.Num Lsql.Csv.Core.Tables.Value instance GHC.Real.Fractional Lsql.Csv.Core.Tables.Value instance GHC.Float.Floating Lsql.Csv.Core.Tables.Value instance GHC.Show.Show Lsql.Csv.Core.Tables.Value -- | This module contains the definition of Symbol, -- SymbolMap, and helper functions. module Lsql.Csv.Core.Symbols -- | The datatype for a single named column (Symbol) data Symbol -- | The datatype containing a Map for aliases of Symbols and -- a list of all Tables data SymbolMap -- | Lookup for a Symbol (NamedColumn) in a SymbolMap (-->) :: SymbolMap -> String -> Symbol -- | Lookup for a Symbol (NamedColumn) in a SymbolMap -- returning a Column (==>) :: SymbolMap -> String -> Column -- | Generates a SymbolMap out of a list of Table. getSymbolMap :: [Table] -> SymbolMap -- | Returns the list of name aliases of all columns. symbolList :: SymbolMap -> [String] -- | Returns the list of Tables out of SymbolMap. getTables :: SymbolMap -> [Table] -- | This module contains the syntactic tree definition, and helper -- functions for its evaluation. module Lsql.Csv.Core.Functions -- | A syntax tree element data Arg -- | A call of function Function :: Function -> Arg -- | A reference to a column Symbol :: String -> Arg -- | A constant Value :: Value -> Arg -- | A syntax tree element data Function -- | An arithmetic function AritmeticF :: AritmeticF -> Function -- | An aggregate function AggregateF :: AggregateF -> Function -- | A logical function LogicF :: LogicF -> Function -- | A syntax tree element data AritmeticF Sin :: Arg -> AritmeticF Cos :: Arg -> AritmeticF Tan :: Arg -> AritmeticF Asin :: Arg -> AritmeticF Acos :: Arg -> AritmeticF Atan :: Arg -> AritmeticF Sinh :: Arg -> AritmeticF Cosh :: Arg -> AritmeticF Tanh :: Arg -> AritmeticF Asinh :: Arg -> AritmeticF Acosh :: Arg -> AritmeticF Atanh :: Arg -> AritmeticF Exp :: Arg -> AritmeticF Sqrt :: Arg -> AritmeticF Size :: Arg -> AritmeticF ToString :: Arg -> AritmeticF Append :: Arg -> Arg -> AritmeticF Round :: Arg -> AritmeticF Truncate :: Arg -> AritmeticF Ceiling :: Arg -> AritmeticF Floor :: Arg -> AritmeticF MinusS :: Arg -> AritmeticF Abs :: Arg -> AritmeticF Signum :: Arg -> AritmeticF Negate :: Arg -> AritmeticF Plus :: Arg -> Arg -> AritmeticF Minus :: Arg -> Arg -> AritmeticF Multiply :: Arg -> Arg -> AritmeticF Divide :: Arg -> Arg -> AritmeticF Power :: Arg -> Arg -> AritmeticF Even :: Arg -> AritmeticF Odd :: Arg -> AritmeticF NaturalPower :: Arg -> Arg -> AritmeticF Div :: Arg -> Arg -> AritmeticF Quot :: Arg -> Arg -> AritmeticF Rem :: Arg -> Arg -> AritmeticF Mod :: Arg -> Arg -> AritmeticF Gcd :: Arg -> Arg -> AritmeticF Lcm :: Arg -> Arg -> AritmeticF Less :: Arg -> Arg -> AritmeticF LessOrEqual :: Arg -> Arg -> AritmeticF More :: Arg -> Arg -> AritmeticF MoreOrEqual :: Arg -> Arg -> AritmeticF Equal :: Arg -> Arg -> AritmeticF NotEqual :: Arg -> Arg -> AritmeticF LeftOuterJoin :: Arg -> Arg -> AritmeticF In :: Arg -> Arg -> AritmeticF -- | A syntax tree element data LogicF And :: Arg -> Arg -> LogicF Or :: Arg -> Arg -> LogicF Not :: Arg -> LogicF -- | A syntax tree element data AggregateF Cat :: [Arg] -> AggregateF Sum :: [Arg] -> AggregateF Avg :: [Arg] -> AggregateF Count :: [Arg] -> AggregateF Min :: [Arg] -> AggregateF Max :: [Arg] -> AggregateF -- | A data type for a single Column or a single Arg data Printable ColumnP :: Column -> Printable ValueP :: Value -> Printable -- | Converts a list of Printable to a list of String -- columns. Useful for generating CSV output. genStrCols :: [Printable] -> [[String]] -- | Converts a list of Printable to a list of Column. getCols :: [Printable] -> [Column] -- | Converts a list of Printable to a Table. getTable :: [String] -> [Printable] -> Table -- | Converts a Table to a list of ColumnP Printables. printTable :: Table -> [Printable] -- | Unions multiple first lines of lists of [Printable] into one -- Printable. unionAggCols :: [[Printable]] -> [Printable] -- | Appends two arguments together. appendArg :: Arg -> Arg -> Arg -- | Appends a list of arguments together. catterate :: [Arg] -> Arg -- | Evaluates all nonagregate functions to Printable. Fails on an -- aggregate function. eval :: SymbolMap -> Arg -> Printable -- | Evaluates all aggregate functions. Normal functions are not evaluated -- if not called under other aggregate function. evalAggregateFunctions :: SymbolMap -> Arg -> Arg -- | Runs through the syntactic tree and checks, whether it contains an -- aggregate function. containsAggregateF :: Arg -> Bool instance GHC.Show.Show Lsql.Csv.Core.Functions.Printable instance GHC.Classes.Ord Lsql.Csv.Core.Functions.Printable instance GHC.Classes.Eq Lsql.Csv.Core.Functions.Printable -- | This module contains the Block definition representing a -- command block and functions for getting a specific type of blocks from -- a list of Block. module Lsql.Csv.Core.BlockOps -- | This data structure represents a command block. data Block Select :: [Arg] -> Block If :: Arg -> Block Sort :: [Arg] -> Block By :: [Arg] -> Block -- | Returns all select blocks. getSelects :: [Block] -> [[Arg]] -- | Makes conjunction of all if blocks (if none, simple True is -- returned) and returns it. getIf :: [Block] -> Arg -- | Finds a sort block, if exists, and returns it. If there is none, [] is -- returned. If there is more than one sort block, fails. getSort :: [Block] -> [Arg] -- | Finds a by block, if exists, and returns it. If there is none, [] is -- returned. If there is more than one by block, fails. getBy :: [Block] -> [Arg] -- | This module contains the evaluator of a lsql-csv program. module Lsql.Csv.Core.Evaluator -- | Evaluates the program in parsed [Block] over the input in -- SymbolMap. evaluate :: SymbolMap -> [Block] -> [Printable] -- | This module contains the preprocessor parser, which splits a command -- into a list of Strings - one String per block. module Lsql.Csv.Lang.BlockSeparator -- | The preprocessor parser function, which splits command into a list of -- Strings - one String per block. splitBlocks :: String -> [String] -- | This module implements the common Option type for from blocks -- and command-line optional arguments representation, and its parsers. module Lsql.Csv.Lang.Options -- | The Option parser monad for parsing from block and command-line -- optional arguments. optionParser :: Parser Option -- | The Option datatype for representing from block and -- command-line optional arguments. data Option Delimiter :: Char -> Option SecondaryDelimiter :: Char -> Option Quote :: Char -> Option Named :: Bool -> Option -- | A module for command-line argument parsing. module Lsql.Csv.Lang.Args -- | A datatype representing all arguments for one run of the lsql-csv data Program Program :: String -> Char -> Char -> Bool -> Program -- | Parses given arguments to a Program representation. parseArgs :: [String] -> Program -- | Loads additional options to a Program. reloadOpts :: Program -> [Option] -> Program instance GHC.Show.Show Lsql.Csv.Lang.Args.Program -- | This module contains the curly bracket (braces) expansion -- implementation. module Lsql.Csv.Utils.BracketExpansion -- | The curly brackets (braces) expand function -- -- The argument is a String, which you want to expand. Returns a -- list of expanded Strings. -- -- There are given a few usage examples: -- --
--   >>> bracketExpand "car{A,B}"
--   ["carA","carB"]
--   
-- --
--   >>> bracketExpand "car{1..5}"
--   ["car1","car2","car3","car4","car5"]
--   
-- --
--   >>> bracketExpand "{car,bus}{0..2}"
--   ["car0","car1","car2","bus0","bus1","bus2"]
--   
bracketExpand :: String -> [String] -- | This module implements the selector expression parser and the -- arithmetic expression parser. module Lsql.Csv.Lang.Selector -- | The selector expression parser selectorP :: [String] -> Parser [Arg] -- | The arithmetic expression parser arithmeticExprP :: [String] -> Parser Arg -- | This module contains the main parser of blocks other than the from -- block. module Lsql.Csv.Lang.BlockChain -- | A function for parsing blocks other than the from block. parseBlocks :: [String] -> [String] -> [Block] -- | This module contains the CsvParser called by the parseFile, -- which loads input CSV files. module Lsql.Csv.Lang.From.CsvParser -- | A data structure representing one input file data Assignment -- | An input file without any assigned names CoreCsv :: Int -> String -> Program -> [Option] -> Assignment -- | An input file with an assigned name NamedCsv :: String -> Assignment -> Assignment -- | Parses CSV file described in the given Assignment. parseFile :: Assignment -> IO Table -- | This module contains the from block parser. It loads the initial -- SymbolMap. module Lsql.Csv.Lang.From.Block -- | Loads SymbolMap according to a Program and a from block -- String in the second argument. getFromSymbols :: Program -> String -> IO SymbolMap -- | This module contains the CSV generator for the output. module Lsql.Csv.Utils.CsvGenerator -- | This function generates the CSV output. csvGenerate :: Char -> Char -> [Printable] -> String -- | This module contains the starting point for a lsql-csv evaluation. module Lsql.Csv.Main -- | The starting point for a lsql-csv evaluation. Returns a String -- with output CSV. run :: Program -> IO String