sv-1.3.1: sv.cabal
name: sv
version: 1.3.1
license: BSD3
license-file: LICENCE
author: George Wilson
maintainer: george@qfpl.io
copyright: Copyright (c) 2017-2019, Commonwealth Scientific and Industrial Research Organisation (CSIRO) ABN 41 687 119 230.
category: CSV, Text, Web
synopsis:
Encode and decode separated values (CSV, PSV, ...)
description:
<<http://i.imgur.com/uZnp9ke.png>>
.
sv (separated values) is a library for parsing, decoding, encoding, and
printing CSV and similar formats (such as PSV, TSV, and many more).
.
sv uses an Applicative combinator style for decoding and encoding, rather
than a type class based approach. This means we can have multiple decoders
for the same type, multiple combinators of the same type, and we never have
to worry about orphan instances. These decoders can be stitched together from
provided primitives and combinators, or you can build one from a parser
from your favourite parser combinator library.
.
For parsing, sv uses <https://hackage.haskell.org/package/hw-dsv hw-dsv>, a high performance streaming CSV parser based on rank-select data structures.
sv works with UTF-8, and should work with CP-1252 as well. It does not work
with UTF-16 or UTF-32.
.
sv returns values for all errors that occur - not just the first. Errors have
more structure than just a string, indicating what went wrong.
.
sv tries not to be opinionated about how your data should look. We intend for
the user to have a great degree of freedom to build the right decoder for
their dataset.
.
Parts of sv are intended to be imported as follows:
.
@
import Data.Sv
import qualified Data.Sv.Decode as D
import qualified Data.Sv.Encode as E
@
.
Examples:
.
* Decoding a real CSV: <https://github.com/qfpl/sv/blob/master/examples/src/Data/Sv/Example/Species.lhs Species.lhs>
* Decoding by column name: <https://github.com/qfpl/sv/blob/master/examples/src/Data/Sv/Example/Columnar.hs Columnar.hs>
* Encoding data to a CSV: <https://github.com/qfpl/sv/blob/master/examples/src/Data/Sv/Example/Encoding.hs Encoding.hs>
* Encoding data to a CSV with a header: <https://github.com/qfpl/sv/blob/master/examples/src/Data/Sv/Example/EncodingWithHeader.hs EncodingWithHeader.hs>
* Handling NULL and Unknown occuring in a column of numbers: <https://github.com/qfpl/sv/blob/master/examples/src/Data/Sv/Example/Numbers.hs Numbers.hs>
* Dealing with non-rectangular data: <https://github.com/qfpl/sv/blob/master/examples/src/Data/Sv/Example/Ragged.hs Ragged.hs>
* Integrating with an existing attoparsec parser to read date stamps: <https://github.com/qfpl/sv/blob/master/examples/src/Data/Sv/Example/TableTennis.hs TableTennis.hs>
.
To get the best performance, the hw-dsv parser and its dependencies
underlying sv should be compiled with the flag @+bmi2@ to enable . These
libraries are: @bits-extra@, @hw-rankselect@, @hw-rankselect-base@, and
@hw-dsv@. A simple way to set the flags for all of them when building with
cabal is to include a cabal.project file in your project containing
something like the following:
.
>packages: .
>package bits-extra
> flags: +bmi2
>package hw-rankselect
> flags: +bmi2
>package hw-rankselect-base
> flags: +bmi2
>package hw-dsv
> flags: +bmi2
homepage: https://github.com/qfpl/sv
bug-reports: https://github.com/qfpl/sv/issues
build-type: Simple
extra-source-files: changelog.md
cabal-version: >=1.10
tested-with: GHC == 7.10.3
, GHC == 8.0.2
, GHC == 8.2.2
, GHC == 8.4.4
, GHC == 8.6.4
source-repository head
type: git
location: git@github.com/qfpl/sv.git
library
exposed-modules: Data.Sv
, Data.Sv.Decode
, Data.Sv.Encode
, Data.Sv.Parse
, Data.Sv.Structure
other-modules: Data.Sv.Alien.Cassava
-- other-extensions:
build-depends: base >=4.8 && < 4.13
, attoparsec >= 0.12.1.4 && < 0.14
, bifunctors >= 5.1 && < 5.6
, bytestring >= 0.9.1.10 && < 0.11
, contravariant >= 1.2 && < 1.6
, hw-dsv >= 0.2.1 && < 0.4
, semigroupoids >= 5 && < 5.4
, sv-core == 0.4.1.*
, transformers >= 0.2 && < 0.6
, utf8-string >= 1 && < 1.1
, validation >= 1 && < 1.1
hs-source-dirs: src
default-language: Haskell2010
ghc-options:
-Wall -O2
test-suite tasty
type:
exitcode-stdio-1.0
main-is:
tasty.hs
other-modules:
Data.Sv.CassavaTest
, Data.Sv.DecodeTest
, Data.Sv.EncodeTest
, Data.Sv.RoundTripsDecodeEncode
default-language:
Haskell2010
build-depends:
base >=4.8 && < 4.13
, bytestring >= 0.9.1.10 && < 0.11
, cassava >= 0.4.1 && < 0.6
, contravariant >= 1.2 && < 1.6
, hedgehog >= 0.5 && < 0.7
, lens >= 4 && < 4.18
, parsers >=0.12 && <0.13
, Only >= 0.1 && < 0.2
, semigroupoids >= 5 && < 5.4
, semigroups >= 0.18 && < 0.19
, sv
, tasty >= 0.11 && < 1.3
, tasty-hedgehog >= 0.1 && < 0.3
, tasty-hunit >= 0.9 && < 0.11
, text >= 1.0 && < 1.3
, trifecta >= 1.5 && < 2.1
, utf8-string >= 1 && < 1.1
, validation >= 1 && < 1.1
, vector >= 0.10 && < 0.13
ghc-options:
-Wall
hs-source-dirs:
test
benchmark criterion
type:
exitcode-stdio-1.0
main-is:
bench.hs
default-language:
Haskell2010
build-depends:
attoparsec >= 0.12.1.4 && < 0.14
, base >=4.8 && < 4.13
, bytestring >= 0.9.1.10 && < 0.11
, criterion >= 1.3 && < 1.6
, deepseq >= 1.1 && < 1.5
, hw-dsv >= 0.2.1 && < 0.4
, lens >= 4 && < 4.18
, sv
, text >= 1.0 && < 1.3
, vector >= 0.10 && < 0.13
ghc-options:
-Wall -O2
hs-source-dirs:
bench