streaming-attoparsec 1.0.0 → 1.0.0.1
raw patch · 3 files changed
+50/−54 lines, 3 filesdep ~attoparsecdep ~streamingdep ~streaming-bytestring
Dependency ranges changed: attoparsec, streaming, streaming-bytestring, tasty, tasty-hunit
Files
- CHANGELOG.md +4/−0
- Data/Attoparsec/ByteString/Streaming.hs +15/−13
- streaming-attoparsec.cabal +31/−41
CHANGELOG.md view
@@ -1,3 +1,7 @@+## 1.0.0.1++- Massaging bounds and code for future- and past-proofing.+ ## 1.0.0 - Initial split from `streaming-utils`, meaning the dependency graph is simplified.
Data/Attoparsec/ByteString/Streaming.hs view
@@ -1,8 +1,10 @@-{- | Here is a simple use of 'parsed' and standard @Streaming@ segmentation devices to- parse a file in which groups of numbers are separated by blank lines. Such a problem- of \'nesting streams\' is described in the @conduit@ context in- <http://stackoverflow.com/questions/32957258/how-to-model-nested-streams-with-conduits/32961296 this StackOverflow question>.+{- | +Here is a simple use of 'parsed' and standard @Streaming@ segmentation devices+to parse a file in which groups of numbers are separated by blank lines. Such a+problem of \'nesting streams\' is described in the @conduit@ context in+<http://stackoverflow.com/questions/32957258/how-to-model-nested-streams-with-conduits/32961296 this StackOverflow question>.+ > -- $ cat nums.txt > -- 1 > -- 2@@ -50,7 +52,7 @@ import Data.ByteString.Streaming import Data.ByteString.Streaming.Internal import Streaming hiding (concats, unfold)-import Streaming.Internal (Stream (..))+import Streaming.Internal (Stream(..)) --- @@ -62,13 +64,13 @@ >>> :set -XOverloadedStrings -- the string literal below is a streaming bytestring >>> (r,rest1) <- AS.parse (A.scientific <* A.many' A.space) "12.3 4.56 78.3" >>> print r-Left 12.3+Right 12.3 >>> (s,rest2) <- AS.parse (A.scientific <* A.many' A.space) rest1 >>> print s-Left 4.56+Right 4.56 >>> (t,rest3) <- AS.parse (A.scientific <* A.many' A.space) rest2 >>> print t-Left 78.3+Right 78.3 >>> Q.putStrLn rest3 -- Nothing left, this prints an empty string. -}@@ -76,7 +78,7 @@ parse parser = begin where begin p0 = case p0 of Go m -> m >>= begin- Empty r -> step id (A.parse parser mempty) (return r)+ Empty r -> step id (A.parse parser B.empty) (return r) Chunk bs p1 | B.null bs -> begin p1 -- attoparsec understands "" as eof | otherwise -> step (chunk bs >>) (A.parse parser bs) p1 @@ -86,14 +88,14 @@ T.Partial k -> do let clean p = case p of -- inspect for null chunks before Go m -> m >>= clean -- feeding attoparsec- Empty r -> step diff (k mempty) (return r)+ Empty r -> step diff (k B.empty) (return r) Chunk bs p1 | B.null bs -> clean p1 | otherwise -> step (diff . (chunk bs >>)) (k bs) p1 clean p0 {-# INLINABLE parse #-} -{-| Apply a parser repeatedly to a stream of bytes, streaming the parsed values, but- ending when the parser fails or the bytes run out.+{-| Apply a parser repeatedly to a stream of bytes, streaming the parsed values,+ but ending when the parser fails or the bytes run out. >>> S.print . void $ AS.parsed (A.scientific <* A.many' A.space) "12.3 4.56 78.9" 12.3@@ -118,7 +120,7 @@ A.Partial k -> do x <- lift (nextChunk p0) case x of- Left e -> step diffP (k mempty) (return e)+ Left e -> step diffP (k B.empty) (return e) Right (bs,p1) | B.null bs -> step diffP res p1 | otherwise -> step (diffP . (chunk bs >>)) (k bs) p1 {-# INLINABLE parsed #-}
streaming-attoparsec.cabal view
@@ -1,53 +1,43 @@--- This file has been generated from package.yaml by hpack version 0.20.0.------ see: https://github.com/sol/hpack------ hash: 90500d245bb6e2f2273b7c717ef402a318fabc31c8196248da19d72c3739e64b+cabal-version: 2.2 -name: streaming-attoparsec-version: 1.0.0-synopsis: Attoparsec integration for the streaming ecosystem-description: Attoparsec integration for the streaming ecosystem.-category: Streaming-homepage: https://github.com/haskell-streaming/streaming-attoparsec-author: Michael Thompson-maintainer: Colin Woodbury, colingw@gmail.com-license: BSD3-license-file: LICENSE-build-type: Simple-cabal-version: >= 1.10+name: streaming-attoparsec+version: 1.0.0.1+synopsis: Attoparsec integration for the streaming ecosystem+description: Attoparsec integration for the streaming ecosystem.+category: Streaming+homepage: https://github.com/haskell-streaming/streaming-attoparsec+author: Michael Thompson+maintainer: Colin Woodbury, colin@fosskers.ca+license: BSD-3-Clause+license-file: LICENSE+build-type: Simple extra-source-files:- CHANGELOG.md README.md+ CHANGELOG.md -library- hs-source-dirs:- ./.- ghc-options: -fwarn-unused-imports -fwarn-unused-binds -fwarn-name-shadowing -fwarn-unused-matches -fwarn-incomplete-patterns -fwarn-incomplete-uni-patterns+common commons+ default-language: Haskell2010+ ghc-options: -Wall -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates build-depends:- attoparsec >=0.13 && <0.14- , base >=4.7 && <5+ base >= 4.7 && < 5+ , attoparsec >= 0.13 , bytestring- , streaming >=0.1.4.5 && <0.3- , streaming-bytestring >=0.1.4.0 && <0.2- exposed-modules:- Data.Attoparsec.ByteString.Streaming- default-language: Haskell2010+ , streaming >= 0.1.4.5+ , streaming-bytestring >= 0.1.4.0 +library+ import: commons+ hs-source-dirs: ./.+ exposed-modules: Data.Attoparsec.ByteString.Streaming+ test-suite streaming-attoparsec-test+ import: commons type: exitcode-stdio-1.0 main-is: Test.hs- hs-source-dirs:- test- ghc-options: -fwarn-unused-imports -fwarn-unused-binds -fwarn-name-shadowing -fwarn-unused-matches -fwarn-incomplete-patterns -fwarn-incomplete-uni-patterns -threaded -with-rtsopts=-N+ hs-source-dirs: test+ ghc-options: -threaded -with-rtsopts=-N build-depends:- attoparsec >=0.13 && <0.14- , base >=4.7 && <5- , bytestring- , streaming >=0.1.4.5 && <0.3- , streaming-attoparsec- , streaming-bytestring >=0.1.4.0 && <0.2- , tasty >=0.11 && <1.1- , tasty-hunit >=0.9 && <0.11- default-language: Haskell2010+ streaming-attoparsec+ , tasty >=0.11+ , tasty-hunit >=0.9