readcsv-0.1.1: Lightweight CSV parser/emitter based on ReadP

Copyright© 2017 George Steel
LicenseMIT
Maintainergeorge.steel@gmail.com
Safe HaskellSafe
LanguageHaskell2010

Text.Read.CSV

Description

Implementation of RFC 4180-compliant CSV parser and emitter. Works with both LF (Unix) and CRLF (DOS) linebreaks and allows varianble-length records. The header line (if one is used) is the first item in the parsed list, and can be separated with a pattern match.

Synopsis

Documentation

readCSV :: String -> Maybe [[String]] Source #

Parse CSV from a string.

writeCSV :: [[String]] -> String Source #

Emit CSV, escaping fields as necessary. Uses Unix linebreaks and a trailing newline.

writeCSVstrict :: [[String]] -> String Source #

Emit CSV with CRLF line breaks ans no trailing newline, as specified by RFC 4180.

csvTableP :: ReadP [[String]] Source #

ReadP parser for CSV.