packages feed

hw-json 1.3.3.0 → 1.3.3.1

raw patch · 6 files changed

+41/−16 lines, 6 filesdep ~doctestdep ~hedgehog

Dependency ranges changed: doctest, hedgehog

Files

app/App/Commands/Count.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE BangPatterns        #-}+{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds           #-} {-# LANGUAGE OverloadedStrings   #-} {-# LANGUAGE ScopedTypeVariables #-}@@ -35,6 +36,9 @@ siblings c = c:maybe [] siblings (nextSibling c)  runCount :: Z.CountOptions -> IO ()+#if aarch64_HOST_ARCH+runCount = undefined+#else runCount opts = do   let inputFile   = opts ^. the @"inputFile"   let expression  = opts ^. the @"expression"@@ -61,6 +65,7 @@   putPretty $ q >>= (entry >=> named expression) & count    return ()+#endif  optsFileIndex :: Parser Z.FileIndexes optsFileIndex = Z.FileIndexes
app/App/Commands/CreateIndex.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE BangPatterns        #-}+{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds           #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications    #-}@@ -21,7 +22,9 @@ import qualified Data.ByteString.Lazy                                               as LBS import qualified HaskellWorks.Data.ByteString                                       as BS import qualified HaskellWorks.Data.ByteString.Lazy                                  as LBS+#if x86_64_HOST_ARCH import qualified HaskellWorks.Data.Json.Simd.Index.Standard                         as STSI+#endif import qualified HaskellWorks.Data.Json.Simple.Cursor.SemiIndex                     as SISI import qualified HaskellWorks.Data.Json.Standard.Cursor.Internal.Blank              as J import qualified HaskellWorks.Data.Json.Standard.Cursor.Internal.BlankedJson        as J@@ -36,6 +39,7 @@ {- HLINT ignore "Redundant do"       -}  runCreateIndexStandard :: Z.CreateIndexOptions -> IO ()+#if x86_64_HOST_ARCH runCreateIndexStandard opts = do   let filePath = opts ^. the @"filePath"   let outputIbFile = opts ^. the @"outputIbFile" & fromMaybe (filePath <> ".ib.idx")@@ -80,8 +84,12 @@     unknown -> do       IO.hPutStrLn IO.stderr $ "Unknown method " <> show unknown       IO.exitFailure+#else+runCreateIndexStandard opts = undefined+#endif  runCreateIndexSimple :: Z.CreateIndexOptions -> IO ()+#if x86_64_HOST_ARCH runCreateIndexSimple opts = do   let filePath = opts ^. the @"filePath"   let outputIbFile = opts ^. the @"outputIbFile" & fromMaybe (filePath <> ".ib.idx")@@ -91,6 +99,9 @@   let SISI.SemiIndex _ ibs bps = SISI.buildSemiIndex bs   LBS.writeFile outputIbFile (LBS.toLazyByteString ibs)   LBS.writeFile outputBpFile (LBS.toLazyByteString bps)+#else+runCreateIndexSimple opts = undefined+#endif  runCreateIndex :: Z.CreateIndexOptions -> IO () runCreateIndex opts = case opts ^. the @"backend" of
app/App/Commands/Demo.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE BangPatterns        #-}+{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds           #-} {-# LANGUAGE OverloadedStrings   #-} {-# LANGUAGE ScopedTypeVariables #-}@@ -29,7 +30,9 @@ import qualified Data.DList                                 as DL import qualified HaskellWorks.Data.BalancedParens.RangeMin  as RM import qualified HaskellWorks.Data.ByteString.Lazy          as LBS+#if x86_64_HOST_ARCH import qualified HaskellWorks.Data.Json.Simd.Index.Standard as S+#endif import qualified Options.Applicative                        as OA import qualified System.IO                                  as IO import qualified System.IO.MMap                             as IO@@ -37,6 +40,7 @@ {- HLINT ignore "Reduce duplication" -}  runDemo :: Z.DemoOptions -> IO ()+#if x86_64_HOST_ARCH runDemo opts = do   let filePath = opts ^. the @"filePath"   case opts ^. the @"method" of@@ -59,6 +63,9 @@           putPretty $ q >>= (entry >=> named "meta" >=> entry >=> named "view" >=> entry >=> named "columns" >=> item >=> entry >=> named "id") & count         Left msg -> IO.hPutStrLn IO.stderr $ "Unable to create semi-index: " <> show msg     m -> IO.hPutStrLn IO.stderr $ "Unrecognised method: " <> show m+#else+runDemo opts = undefined+#endif  optsDemo :: Parser Z.DemoOptions optsDemo = Z.DemoOptions
hw-json.cabal view
@@ -1,7 +1,7 @@ cabal-version:  2.2  name:                   hw-json-version:                1.3.3.0+version:                1.3.3.1 synopsis:               Memory efficient JSON parser description:            Memory efficient JSON parser. Please see README.md category:               Data@@ -9,10 +9,10 @@ bug-reports:            https://github.com/haskell-works/hw-json/issues author:                 John Ky maintainer:             newhoggy@gmail.com-copyright:              2016-2021 John Ky+copyright:              2016-2025 John Ky license:                BSD-3-Clause license-file:           LICENSE-tested-with:            GHC == 9.8.2, GHC == 9.6.6+tested-with:            GHC == 9.12.2, GHC == 9.10.2, GHC == 9.8.4, GHC == 9.6.7 build-type:             Simple extra-source-files:     README.md                         corpus/5000B.json@@ -48,15 +48,18 @@ common criterion                  { build-depends: criterion                  >= 1.4        && < 1.7    } common directory                  { build-depends: directory                  >= 1.3        && < 1.4    } common dlist                      { build-depends: dlist                      >= 0.8        && < 1.1    }-common doctest                    { build-depends: doctest                    >= 0.16.2     && < 0.23   }+common doctest                    { build-depends: doctest                    >= 0.16.2     && < 1      } common doctest-discover           { build-depends: doctest-discover           >= 0.2        && < 0.3    } common generic-lens               { build-depends: generic-lens               >= 1.2.0.1    && < 2.3    }-common hedgehog                   { build-depends: hedgehog                   >= 0.6        && < 1.5    }+common hedgehog                   { build-depends: hedgehog                   >= 0.6        && < 2      } common hspec                      { build-depends: hspec                      >= 2.4        && < 3      } common hw-balancedparens          { build-depends: hw-balancedparens          >= 0.3.0.0    && < 0.5    } common hw-bits                    { build-depends: hw-bits                    >= 0.7.0.5    && < 0.8    } common hw-hspec-hedgehog          { build-depends: hw-hspec-hedgehog          >= 0.1.0.4    && < 0.2    }-common hw-json-simd               { build-depends: hw-json-simd               >= 0.1.0.2    && < 0.2    }+common hw-json-simd {+  if arch(x86_64)+    build-depends: hw-json-simd               >= 0.1.0.2    && < 0.2+} common hw-json-simple-cursor      { build-depends: hw-json-simple-cursor      >= 0.1.0.1    && < 0.2    } common hw-json-standard-cursor    { build-depends: hw-json-standard-cursor    >= 0.2.0.1    && < 0.3    } common hw-mquery                  { build-depends: hw-mquery                  >= 0.2.0.0    && < 0.3    }@@ -64,7 +67,10 @@ common hw-prim                    { build-depends: hw-prim                    >= 0.6.2.32   && < 0.7    } common hw-rankselect              { build-depends: hw-rankselect              >= 0.13       && < 0.14   } common hw-rankselect-base         { build-depends: hw-rankselect-base         >= 0.3.2.1    && < 0.4    }-common hw-simd                    { build-depends: hw-simd                    >= 0.1.1.2    && < 0.2    }+common hw-simd {+  if arch(x86_64)+    build-depends: hw-simd                    >= 0.1.1.2    && < 0.2+} common lens                       { build-depends: lens                       >= 4          && < 6      } common mmap                       { build-depends: mmap                       >= 0.5        && < 0.6    } common optparse-applicative       { build-depends: optparse-applicative       >= 0.14       && < 0.19   }
src/HaskellWorks/Data/Json/LightJson.hs view
@@ -102,7 +102,6 @@   pretty mjpv = case mjpv of     Mini (LightJsonString s   ) -> dullgreen  (text (show s))     Mini (LightJsonNumber n   ) -> cyan       (text (show n))-    Mini (LightJsonObject []  ) -> text "{}"     Mini (LightJsonObject kvs ) -> case kvs of       (_:_:_:_:_:_:_:_:_:_:_:_:_) -> text "{" <> prettyKvs (map (second lightJsonAt) kvs) <> text ", ..}"       []                          -> text "{}"
test/HaskellWorks/Data/Json/LightJsonSpec.hs view
@@ -6,8 +6,6 @@ {-# LANGUAGE ScopedTypeVariables       #-} {-# LANGUAGE TupleSections             #-} -{-# OPTIONS_GHC -fno-warn-missing-signatures #-}- module HaskellWorks.Data.Json.LightJsonSpec (spec) where  import Control.Monad@@ -38,7 +36,10 @@ {- HLINT ignore "Redundant bracket"  -} {- HLINT ignore "Redundant do"       -} +fc :: TC.TreeCursor k => k -> Maybe k fc = TC.firstChild++ns :: TC.TreeCursor k => k -> Maybe k ns = TC.nextSibling  spec :: Spec@@ -72,11 +73,7 @@         elements c = jsonValueVia (Just c)  genSpec :: forall t u.-  ( Eq                t-  , Show              t-  , Select1           t-  , Eq                u-  , Show              u+  ( Select1           t   , Rank0             u   , Rank1             u   , BalancedParens    u@@ -84,7 +81,7 @@   => String -> (String -> GenericCursor BS.ByteString t u) -> SpecWith () genSpec t makeCursor = do   describe ("Json cursor of type " ++ t) $ do-    let forJson s f = describe ("of value " ++ show s) (f (makeCursor s))+    let forJson s f = describe ("of value " ++ Prelude.show s) (f (makeCursor s))     forJson "{}" $ \cursor -> do       it "should have correct value"      $ requireTest $ jsonValueVia (Just cursor) === Right (JsonObject [])     forJson " {}" $ \cursor -> do