conduit-aeson 0.1.0.1 → 0.1.1.0
raw patch · 6 files changed
+29/−21 lines, 6 filesdep +attoparsec-aesondep +doctestdep −doctest-paralleldep ~aesonsetup-changedPVP ok
version bump matches the API change (PVP)
Dependencies added: attoparsec-aeson, doctest
Dependencies removed: doctest-parallel
Dependency ranges changed: aeson
API changes (from Hackage documentation)
Files
- CHANGELOG.md +1/−0
- Setup.hs +0/−1
- conduit-aeson.cabal +13/−10
- src/Data/Conduit/Aeson.hs +7/−2
- tests/Data/Conduit/AesonSpec.hs +6/−5
- tests/doctests.hs +2/−3
CHANGELOG.md view
@@ -3,6 +3,7 @@ ## 0.1.1.0 * Expose `valueMaybeParser`+* Fix `Setup.hs` [#1](https://github.com/lehins/conduit-aeson/issues/1) ## 0.1.0.0
Setup.hs view
@@ -2,5 +2,4 @@ main :: IO () main = defaultMain-#endif
conduit-aeson.cabal view
@@ -1,5 +1,5 @@ name: conduit-aeson-version: 0.1.0.1+version: 0.1.1.0 synopsis: Short description description: Please see the README on GitHub at <https://github.com/lehins/conduit-aeson#readme> homepage: https://github.com/lehins/conduit-aeson@@ -10,17 +10,18 @@ copyright: 2021-2022 Alexey Kuleshevich category: Algorithms build-type: Simple-extra-source-files: README.md+extra-doc-files: README.md , CHANGELOG.md cabal-version: 1.18-tested-with: GHC == 8.4.3- , GHC == 8.4.4- , GHC == 8.6.3- , GHC == 8.6.4+tested-with: GHC == 8.4.4 , GHC == 8.6.5- , GHC == 8.8.1- , GHC == 8.8.2- , GHC == 8.10.1+ , GHC == 8.8.4+ , GHC == 8.10.7+ , GHC == 9.0.2+ , GHC == 9.2.8+ , GHC == 9.4.8+ , GHC == 9.6.5+ , GHC == 9.8.2 library hs-source-dirs: src@@ -34,6 +35,8 @@ , conduit , conduit-extra , text+ if impl(ghc >= 8.2)+ build-depends: attoparsec-aeson default-language: Haskell2010 ghc-options: -Wall@@ -52,7 +55,7 @@ , bytestring , conduit , conduit-aeson- , doctest-parallel+ , doctest default-language: Haskell2010 ghc-options: -Wall -Wincomplete-record-updates
src/Data/Conduit/Aeson.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE ExplicitForAll #-} {-# LANGUAGE LambdaCase #-}+{-# LANGUAGE MonoLocalBinds #-} -- | -- Module : Data.Conduit.Aeson -- Copyright : (c) Alexey Kuleshevich 2021-2022@@ -73,6 +74,7 @@ -- >>> :set -XTypeApplications -- >>> :set -XOverloadedStrings -- >>> import Conduit+-- >>> import Data.Conduit.Aeson -- >>> runConduit $ yield ("[1,2,3,4]") .| conduitArray @Int .| printC -- 1 -- 2@@ -122,6 +124,7 @@ -- Parse a new line delimited JSON values. -- -- >>> import Conduit+-- >>> import Data.Conduit.Aeson -- >>> import Data.ByteString.Char8 (ByteString, pack) -- >>> import Data.Attoparsec.ByteString.Char8 (char8) -- >>> let input = pack "{\"foo\":1}\n{\"bar\":2}\n" :: ByteString@@ -156,6 +159,7 @@ -- >>> :set -XOverloadedStrings -- >>> :set -XTypeApplications -- >>> import Conduit+-- >>> import Data.Conduit.Aeson -- >>> let input = "{ \"foo\": 1, \"bar\": 2, \"baz\": 3 }" -- >>> runConduit $ yield input .| conduitObject @String @Int .| printC -- ("foo",1)@@ -216,6 +220,7 @@ -- ===__Examples__ -- -- >>> import Conduit+-- >>> import Data.Conduit.Aeson -- >>> import Data.ByteString.Char8 (ByteString, pack) -- >>> import Data.Attoparsec.ByteString.Char8 (char8) -- >>> let input = pack "\"foo\":1|\"bar\":2|" :: ByteString@@ -288,7 +293,7 @@ Atto.Parser a -- ^ Suffix parser -> Atto.Parser Aeson.Value-valueParser dp = skipSpace *> json' <* dp+valueParser dp = skipSpace *> Aeson.json' <* dp -- | Parse a JSON value followed either by a delimiter or terminating -- character @']'@, which is also supplied to the delimiter parser. Nothing is@@ -301,7 +306,7 @@ -> Atto.Parser (Maybe Aeson.Value) valueMaybeParser dp = let t = ']'- in skipSpace *> ((Nothing <$ Atto8.char t) <|> (Just <$> json' <* dp t))+ in skipSpace *> ((Nothing <$ Atto8.char t) <|> (Just <$> Aeson.json' <* dp t)) -- | Consume @'{'@ with all preceeding space characters --
tests/Data/Conduit/AesonSpec.hs view
@@ -8,20 +8,17 @@ import Data.Aeson import Data.Conduit.Aeson import qualified Data.Map.Strict as Map-import Data.Scientific import qualified Data.Text as T import GHC.Exts import Test.Hspec import Test.Hspec.QuickCheck import Test.QuickCheck -instance Arbitrary T.Text where- arbitrary = T.pack <$> arbitrary- #if !MIN_VERSION_aeson(2,0,3)+import Data.Scientific+ instance Arbitrary Value where arbitrary = sized sizedArbitraryValue-#endif sizedArbitraryValue :: Int -> Gen Value sizedArbitraryValue n@@ -34,6 +31,10 @@ string = String <$> arbitrary array = Array . fromList <$> arbitrary object' = listToObject <$> arbitrary+#endif++instance Arbitrary T.Text where+ arbitrary = T.pack <$> arbitrary listToObject :: [(String, Value)] -> Value listToObject xs = object [(fromString k, v) | (k, v) <- xs]
tests/doctests.hs view
@@ -3,11 +3,10 @@ module Main where #if __GLASGOW_HASKELL__ >= 802-import Test.DocTest (mainFromCabal)-import System.Environment (getArgs)+import Test.DocTest (doctest) main :: IO ()-main = mainFromCabal "conduit-aeson" =<< getArgs+main = doctest ["-XHaskell2010", "-XCPP", "src/Data/Conduit/Aeson.hs"] #else import System.IO