@hackage / streaming-cassava

Cassava support for the streaming ecosystem

Latest0.2.0.0

About

Metadata

  • Last updated , by IvanMiljenovic
  • License MIT
  • Categories Streaming
  • Maintained by: Ivan.Miljenovic@gmail.com

  • Lottery factor: 0

Links

Installation

Tested Compilers

  1. 8.10.4
  2. 8.8.4
  3. 8.6.5
  4. 8.4.4
  5. 8.2.2
  6. 8.0.2

Readme

streaming-cassava

Hackage Build Status

cassava support for the streaming ecosystem

This library allows you to easily stream CSV data in and out. You can do so using both "plain" record-based (with optional header support) or name-based (header required to determine ordering) encoding/decoding.

All encoding/decoding options are supported, it's possible to automatically add on default headers and you can even choose whether to fail on the first parse error or handle errors on a row-by-row basis.

Reading data from file

A common use-case is to stream CSV-encoded data in from a file. You may be tempted to use readFile from streaming-bytestring to obtain the file contents, and for simple cases this should suffice. However, the recommended solution is to use the streaming-with package for the IO aspects. You can then write something like:

withBinaryFileContents \"myFile.csv\" $
  doSomethingWithStreamingCSV
  . 'decodeByName'