sv-1.4: Encode and decode separated values (CSV, PSV, ...)

Data.Sv.Decode

Description

This module contains data structures, combinators, and primitives for decoding a CSV into a list of your Haskell datatype.

A file can be read with parseDecodeFromFile. If you already have the text data in memory, it can be decoded with parseDecode. You will need a Decode for your desired type.

A Decode can be built using the primitives in this file. Decode is an Applicative and an Alt, allowing for composition of these values with <*> and <!>

The primitive Decodes in this file which use ByteString expect UTF-8 encoding. The Decode type has an instance of Profunctor, so you can lmap or alterInput to reencode on the way in.

This module is intended to be imported qualified like so

import qualified Data.Sv.Decode as D