streaming-cassava 0.1.0.0 → 0.1.0.1
raw patch · 4 files changed
+49/−5 lines, 4 filesdep ~streamingPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: streaming
API changes (from Hackage documentation)
- Streaming.Cassava: DecodeOptions :: {-# UNPACK #-} ~Word8 -> DecodeOptions
+ Streaming.Cassava: DecodeOptions :: {-# UNPACK #-} !Word8 -> DecodeOptions
- Streaming.Cassava: EncodeOptions :: {-# UNPACK #-} ~Word8 -> ~Bool -> ~Bool -> ~Quoting -> EncodeOptions
+ Streaming.Cassava: EncodeOptions :: {-# UNPACK #-} !Word8 -> !Bool -> !Bool -> !Quoting -> EncodeOptions
- Streaming.Cassava: [decDelimiter] :: DecodeOptions -> {-# UNPACK #-} ~Word8
+ Streaming.Cassava: [decDelimiter] :: DecodeOptions -> {-# UNPACK #-} !Word8
- Streaming.Cassava: [encDelimiter] :: EncodeOptions -> {-# UNPACK #-} ~Word8
+ Streaming.Cassava: [encDelimiter] :: EncodeOptions -> {-# UNPACK #-} !Word8
- Streaming.Cassava: [encIncludeHeader] :: EncodeOptions -> ~Bool
+ Streaming.Cassava: [encIncludeHeader] :: EncodeOptions -> !Bool
- Streaming.Cassava: [encQuoting] :: EncodeOptions -> ~Quoting
+ Streaming.Cassava: [encQuoting] :: EncodeOptions -> !Quoting
- Streaming.Cassava: [encUseCrLf] :: EncodeOptions -> ~Bool
+ Streaming.Cassava: [encUseCrLf] :: EncodeOptions -> !Bool
Files
- ChangeLog.md +7/−1
- README.md +21/−1
- src/Streaming/Cassava.hs +18/−0
- streaming-cassava.cabal +3/−3
ChangeLog.md view
@@ -1,5 +1,11 @@ # Revision history for streaming-cassava -## 0.1.0.0 -- 2017-06-30+## 0.1.0.1 -- 2018-01-23++* Bump dependency on `streaming`.++* Document what to do with `readFile` errors.++## 0.1.0.0 -- 2017-06-30 * First version.
README.md view
@@ -1,7 +1,7 @@ streaming-cassava ================= -[](https://hackage.haskell.org/package/streaming-cassava) [](https://travis-ci.org/ivan-m/streaming-cassava)+[](https://hackage.haskell.org/package/streaming-cassava) [](https://travis-ci.org/haskell-streaming/streaming-cassava) > [cassava] support for the [streaming] ecosystem @@ -17,3 +17,23 @@ automatically add on default headers and you can even choose whether to fail on the first parse error or handle errors on a row-by-row basis.++Errors with `readFile`+----------------------++A common use-case is to stream CSV-encoded data in from a file. You+may be tempted to use `readFile` from [streaming-bytestring] to obtain+the file contents, but if you do you're likely to run into exceptions+such as `hGetBufSome: illegal operation (handle is closed)`.++The recommended solution is to use the [streaming-with] package for+the IO aspects. You can then write something like:++```haskell+withBinaryFileContents \"myFile.csv\" $+ doSomethingWithStreamingCSV+ . 'decodeByName'+```++[streaming-bytestring]: https://hackage.haskell.org/package/streaming-bytestring+[streaming-with]: https://hackage.haskell.org/package/streaming-with
src/Streaming/Cassava.hs view
@@ -8,7 +8,25 @@ License : MIT Maintainer : Ivan.Miljenovic@gmail.com + Stream CSV data in\/out using+ [Cassava](http://hackage.haskell.org/package/cassava). + A common use-case is to stream CSV-encoded data in from a file.+ You may be tempted to use 'B.readFile' from+ "Data.ByteString.Streaming" to obtain the file contents, but if you+ do you're likely to run into exceptions such as:++ > hGetBufSome: illegal operation (handle is closed)++ One solution is to use the+ [streaming-with](https://hackage.haskell.org/package/streaming-with)+ package for the IO aspects. You can then write something like:++ @+ withBinaryFileContents \"myFile.csv\" $+ doSomethingWithStreamingCSV+ . 'decodeByName'+ @ -} module Streaming.Cassava
streaming-cassava.cabal view
@@ -1,5 +1,5 @@ name: streaming-cassava-version: 0.1.0.0+version: 0.1.0.1 synopsis: Cassava support for the streaming ecosystem description:@@ -20,7 +20,7 @@ source-repository head type: git- location: https://github.com/ivan-m/streaming-cassava.git+ location: https://github.com/haskell-streaming/streaming-cassava.git library exposed-modules: Streaming.Cassava@@ -28,7 +28,7 @@ , bytestring , cassava == 0.5.* , mtl- , streaming >= 0.1.1.0 && < 0.2+ , streaming >= 0.1.1.0 && < 0.3 , streaming-bytestring < 0.2 , transformers hs-source-dirs: src