Copyright | (c) Marcin Mrotek 2015 |
---|---|
License | BSD3 |
Maintainer | marcin.jan.mrotek@gmail.com |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Pipes.KeyValueCsv.KeyValue
Description
Parse key-value pairs.
- parseKeyValues :: forall (m :: * -> *) (f :: k -> *) (rs :: [k]) (r :: *). (Given Delimiter, Monad m, Record rs) => KeyValueOptions m f rs -> Lines m r -> m (Rec (WithKeyValueError :. f) rs, r)
- foldHeader :: (Monad m, Record rs) => Producer (Rec (WithKeyValueError :. f) rs) m r -> m (Rec (WithKeyValueError :. f) rs, r)
- joinRecs :: Rec (WithKeyValueError :. f) rs -> Rec (WithKeyValueError :. f) rs -> Rec (WithKeyValueError :. f) rs
- class Record k (rs :: [k])
- data KeyValueError
Documentation
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 Rec
s, replacing missing values with successes and accumulating failures.
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
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. |
Instances