pipes-key-value-csv-0.0.0.0: 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

Contents

Description

Parse CSV files with key-value headers.

Synopsis

Documentation

breakLines :: Monad m => (Text -> Bool) -> Lines m r -> Lines m (Lines m r) Source

Break a stream of lines into two parts, on a line that satisfies the given predicate. All input lines up to the breaking one will be fully read, and each (not including the breaking one) will be re-yielded.

parseKeyValueCsv :: forall m f g hs rs r. (Monad m, Record hs) => Options m f g hs rs -> Producer Text m r -> m (Rec (WithKeyValueError :. f) hs, Producer (Rec (WithCsvError :. g) rs) m r) Source

Read a CSV file preceded by key-value pairs.

class Record rs where

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

Methods

proxyRecord :: Rec k (Proxy k) rs

Instances

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

Re-exports

data AccValidation err a :: * -> * -> *

A value of the type err or a, however, the Applicative instance accumulates values. This is witnessed by the Semigroup context on the instance. Note that there is no Monad such that ap = (*).

>>> _Success # (+1) <*> _Success # 7 :: AccValidation String Int
AccSuccess 8
>>> _Failure # ["f1"] <*> _Success # 7 :: AccValidation [String] Int
AccFailure ["f1"]
>>> _Success # (+1) <*> _Failure # ["f2"] :: AccValidation [String] Int
AccFailure ["f2"]
>>> _Failure # ["f1"] <*> _Failure # ["f2"] :: AccValidation [String] Int
AccFailure ["f1","f2"]

Constructors

AccFailure err 
AccSuccess a 

Instances

Bifunctor AccValidation 
Bitraversable AccValidation 
Swapped AccValidation 
Validate AccValidation 
Bifoldable AccValidation 
Functor (AccValidation err) 
Semigroup err => Applicative (AccValidation err) 
Foldable (AccValidation err) 
Traversable (AccValidation err) 
Semigroup err => Alt (AccValidation err) 
Semigroup err => Apply (AccValidation err) 
(Eq err, Eq a) => Eq (AccValidation err a) 
(Data err, Data a) => Data (AccValidation err a) 
(Ord err, Ord a) => Ord (AccValidation err a) 
(Show err, Show a) => Show (AccValidation err a) 
Monoid e => Monoid (AccValidation e a)
((x `mappend` y) `mappend` z) == (x `mappend` (y `mappend` z :: AccValidation [String] Int))
mempty `mappend` x == (x :: AccValidation [String] Int)
x `mappend` mempty == (x :: AccValidation [String] Int)
Semigroup e => Semigroup (AccValidation e a)
((x <> y) <> z) == (x <> (y <> z :: AccValidation [String] Int))