pipes-key-value-csv-0.4.0.1: Streaming processing of CSV files preceded by key-value pairs.

Copyright(c) Marcin Mrotek 2015
LicenseBSD3
Maintainermarcin.jan.mrotek@gmail.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Pipes.KeyValueCsv.KeyValue

Description

Parse key-value pairs.

Synopsis

Documentation

parseKeyValues Source #

Arguments

:: forall (m :: * -> *) (f :: k -> *) (rs :: [k]) (r :: *). (Given Delimiter, Monad m, Record rs) 
=> KeyValueOptions m f rs

Options

-> Lines m r

Stream of lines

-> m (Rec (WithKeyValueError :. f) rs, r) 

Parse lines into a stream of records with at most one Success field.

foldHeader :: (Monad m, Record rs) => Producer (Rec (WithKeyValueError :. f) rs) m r -> m (Rec (WithKeyValueError :. f) rs, r) Source #

Fold a stream of key-value records into a single record.

joinRecs :: Rec (WithKeyValueError :. f) rs -> Rec (WithKeyValueError :. f) rs -> Rec (WithKeyValueError :. f) rs Source #

Join two Recs, replacing missing values with successes and accumulating failures.

class Record k rs #

Create a dummy record parametrized by Proxy. The class is named Record to signify that every possible type list is its instance.

Minimal complete definition

proxyRecord

Instances

Record k ([] k) 

Methods

proxyRecord :: Rec [k] (Proxy [k]) rs #

Record k rs => Record k ((:) k r rs) 

Methods

proxyRecord :: Rec ((k ': r) rs) (Proxy ((k ': r) rs)) rs #

data KeyValueError Source #

An error that occured during the parsing of the header.

Constructors

MissingValue

A value is missing in the header.

MultipleValues

A value is given multiple times.

ValueParsingError String

Parsing error as returned by Data.Text.Lazy.Read.