cassava-records 0.1.0.1 → 0.1.0.2
raw patch · 3 files changed
+25/−20 lines, 3 files
Files
- ChangeLog.md +3/−1
- README.md +20/−17
- cassava-records.cabal +2/−2
ChangeLog.md view
@@ -1,3 +1,5 @@ # Changelog for cassava-records -## Unreleased changes+## 0.1.0.2++- Fix README.md
README.md view
@@ -1,7 +1,8 @@ # cassava-records -A library extension for Cassava (Haskell CSV parser library) that-automatically creates a Record given the csv file.+A library extension for ```cassava``` (Haskell CSV parser library) that+automatically creates a Record data type given an columnar input file. eg+a CSV file. # What is this tool for? @@ -10,21 +11,23 @@ cassava for loading the input files, here is a typical workflow you would follow -a. Inspect the file-b. Create a ```Record``` data type to reflect the columns and types-found in the file-c. Create instances of the Record type that may be required to load-the files with Cassava.+a. Inspect the file that contains ```Salaries``` of ```Employees```. +b. Create a ```Record``` data type called ```Salaries``` to reflect +the columns and types found in the file++c. Create required instances of the ```Salaries``` data type that may be +required to load the files with ```cassava```.+ Now, imagine this file you are inspecting to contains tens or hundreds of columns. Now, as a good Haskeller you will want to automate steps (a) and (b) to the extend possible. That is precisely, what this library does. -Cassava-records performs the following tasks. Given, a input file+```cassava-records``` performs the following tasks. Given, a input file (command or tab-seperated for example), it reads the whole file,-infers some basic data types for each column and automatically created-a ```Record``` data type using ```Template Haskell```.+infers some basic data types for each column and automatically creates+a ```Record``` of inferred data types using ```Template Haskell```. # Quick Start@@ -59,7 +62,7 @@ ``` -The ```makeCsvRecord``` needs take 4 arguments,+The ```makeCsvRecord``` function take 4 arguments, 1. ```"Salaries"``` : A ```String``` that will be used as name for the ```Record```.@@ -259,17 +262,17 @@ # Caveats (Or list of future enhancements) -1. The columns names along with prefix should be valid Haskell field+1. The columns names along with prefix("_") should be a valid Haskell field names. For example, column names cannot have spaces or other- characters not supported by ```field``` names are not supported.+ characters not supported for use as ```field``` names of ```Record``` data type. 2. The library loads the whole file during compilation to infer types. Given the size of the file, this will increase the compile time. Alternative workflows, like stripping the file or dumping the created slice into a file is recommended. In the future, the- makeCsvRecord function can take a parameter to specify the minimum+ makeCsvRecord function can take a parameter to specify the max number of rows that can be used to infer the types.-3. Supported types are limited. Text, Bool, Integer, Double and the MayBe- variants of those.+3. The inferred types are limited. Text, Bool, Integer, Double and the MayBe+ variants of those. Future, support may include DateTime. 4. Mixed case column headers not automatically supported. A more complex form of ```fieldOptionModifiers``` needs to be provided.-5. Currently no options to provide custom types.+5. Currently there is no option to provide custom types.
cassava-records.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 0bffe2f75342705e1118590c7c078b18e36b2505e4d8e923697990336485addb+-- hash: a0ddcd21e9c960a2db98c19cc741cf634581aeb7f79e42779e7c90283f4903f0 name: cassava-records-version: 0.1.0.1+version: 0.1.0.2 synopsis: Auto-generation of records data type. description: cassava-records library helps in auto-creating record data types using Template Haskell by inferring types from the columns of a csv or compatible input file. The record and type classes instances generated can be seamlessly used with cassava(the haskell csv reader library) to load the data into these record types without dealing with any other level of abstraction. Please see README on Github at <https://github.com/gdevanla/cassava-records#readme>