| Copyright | (c) Marcin Mrotek, 2015 |
|---|---|
| License | BSD3 |
| Maintainer | marcin.jan.mrotek@gmail.com |
| Stability | experimental |
| Safe Haskell | None |
| Language | Haskell2010 |
Pipes.KeyValueCsv
Contents
Description
Parse CSV files with key-value headers.
- breakLines :: Monad m => (Text -> Bool) -> Lines m r -> Lines m (Lines m r)
- 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)
- module Pipes.KeyValueCsv.Csv
- module Pipes.KeyValueCsv.KeyValue
- module Pipes.KeyValueCsv.Types
- class Record rs where
- proxyRecord :: Rec k (Proxy k) rs
- data AccValidation err a :: * -> * -> *
- = AccFailure err
- | AccSuccess a
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.
module Pipes.KeyValueCsv.Csv
module Pipes.KeyValueCsv.KeyValue
module Pipes.KeyValueCsv.Types
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
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 IntAccSuccess 8
>>>_Failure # ["f1"] <*> _Success # 7 :: AccValidation [String] IntAccFailure ["f1"]
>>>_Success # (+1) <*> _Failure # ["f2"] :: AccValidation [String] IntAccFailure ["f2"]
>>>_Failure # ["f1"] <*> _Failure # ["f2"] :: AccValidation [String] IntAccFailure ["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)) |