cookbook-2.1.2.1: Tiered general-purpose libraries with domain-specific applications.

PortabilityPortable (Cookbook
StabilityStable
Maintainernathanpisarski@gmail.com
Safe HaskellSafe-Inferred

Cookbook.Project.Quill.Quill

Description

A library for reading simple databases. As what was originally a quirk of the library, database tables can be split up and still parsed as if they were a unit, giving it the ability to read the same table from multiple files in parallel. Quill supports a comment syntax, whitespace-insignificant parsing, and a full CRUD API. Quill will EVENTUALLY be replaced by Scribe2, but the planning for Scribe2 has not yet begun.

Synopsis

Documentation

data Table Source

A table is a record of a name and the information within it.

Constructors

Table 

Fields

name :: String
 
info :: [(String, String)]
 

prepare :: [String] -> StringSource

Sanitizes strings for Quill processing. Removes comments, newlines, and flattens it into a string.

tokenize :: [a] -> [(a, a)]Source

Splits a list into tupples.

tblNames :: String -> [String]Source

Returns the names of all tables in the file.

headlessData :: String -> [[String]]Source

  • Should not be used raw except for API programming. Really shouldn't be included, but too lazy to enumerate top-level declarations for selective export* Returns all entry lines from within tables in database.

tokenLists :: [[String]] -> [[(String, String)]]Source

Returns all of the tokens from headlessData.

tables :: [String] -> [(String, [(String, String)])]Source

Creates a listing of all tables in the file.

getTable :: [(String, [(String, String)])] -> String -> [(String, String)]Source

Gets a particular table in the file, returning its key-value pairs.

lookUp :: [(String, [(String, String)])] -> (String, String) -> [String]Source

Gets the particular item within a table from a database.

createTable :: [(String, [(String, String)])] -> String -> [(String, [(String, String)])]Source

Creates a new table within the database.

removeTable :: [(String, [(String, String)])] -> String -> [(String, [(String, String)])]Source

Removes an entire table from the database by name.

removeItem :: [(String, [(String, String)])] -> (String, String) -> [(String, [(String, String)])]Source

Removes a particular item from a table within a database.

addItem :: [(String, [(String, String)])] -> String -> (String, String) -> [(String, [(String, String)])]Source

Adds an item to a table within a database.

changeItem :: [(String, [(String, String)])] -> (String, String) -> String -> [(String, [(String, String)])]Source

Changes an item within a table. The identifier will remain the same; only the rvalue will change.

tableToString :: (String, [(String, String)]) -> StringSource

Basically a toString function for Quill tables. It turns data into a String format which can be parsed by the Quill parsing stack.