Copyright | (C) CSIRO 2017-2018 |
---|---|
License | BSD3 |
Maintainer | George Wilson <george.wilson@data61.csiro.au> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
This module provides integration between sv and cassava. It lets you plug cassava's (very fast!) parser into sv's decoding layer.
Our benchmarking indicates that parsing is very expensive, while decoding is comparatively less performance-sensitive. So if performance matters to you, and cassava's parser is sufficient for your needs, you might as well use it!
sv's own parser is much slower than cassava's right now, but aims to have better error messages and keep more information for you to work with, such as spacing, quoting, and newline information.
Synopsis
- parseDecodeFromCassava :: Decode' ByteString a -> Headedness -> DecodeOptions -> ByteString -> DecodeValidation ByteString [a]
- parseCassava :: DecodeOptions -> ByteString -> DecodeValidation ByteString Csv
- decodeFromCassava :: Decode' ByteString a -> Csv -> DecodeValidation ByteString [a]
Documentation
parseDecodeFromCassava :: Decode' ByteString a -> Headedness -> DecodeOptions -> ByteString -> DecodeValidation ByteString [a] Source #
Parse a Csv
from a ByteString
using cassava's parser, then
decode it using the given Decode
.
This has the benefit of letting you use cassava's parser, which is very fast, with sv's decoding.
parseCassava :: DecodeOptions -> ByteString -> DecodeValidation ByteString Csv Source #
Parse a Csv
from a ByteString
using cassava's parser
This returns its result in a DecodeValidation
, so that it's compatible
with the rest of sv.
decodeFromCassava :: Decode' ByteString a -> Csv -> DecodeValidation ByteString [a] Source #
Use an sv Decode
to decode from cassava's Csv
type.