hjson-query 1.0 → 1.0.1
raw patch · 3 files changed
+18/−16 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- examples/Example1.hs +11/−11
- hjson-query.cabal +1/−1
- src/Text/HJson/Query.hs +6/−4
examples/Example1.hs view
@@ -11,13 +11,13 @@ j6 = jParse"{\"America\": {\"USA\": [], \"Canada\": [\"Toronto\"]}}" j7 = jParse "{\"Australia\": [\"Melburn\", \"Adelaida\"]}" merg = mergesRec [j1, j2, j3, j4, j5, j6, j7]-ex0 = putJson merg+ex0 = pputJson merg --------------------------------------------------------------------------- query1 = getFromKeys ["Europa", "America", "Africa"] json1 = query1 merg -ex1 = putJsons json1+ex1 = pputJsons json1 --------------------------------------------------------------------------- record1 = "[\"Sidoroff\",\"Jhon\",1975,null]"@@ -27,7 +27,7 @@ query2 = query1 >>> getFromObj json2 = query2 merg-ex2 = putJsons json2+ex2 = pputJsons json2 --------------------------------------------------------------------------- @@ -35,17 +35,17 @@ q31 = getFromKeys ["Europa", "America", "Africa", "Australia"] >>> (getFromArr `orElse` getFromObj) >>> (isStr `orElse` getFromArr)-ex31 = putJsons $ q31 merg+ex31 = pputJsons $ q31 merg q32 = getFromKeys ["Europa", "America", "Africa", "Australia"] >>> (getFromObj `when` isObj) >>> getFromArr-ex32 = putJsons $ q32 merg+ex32 = pputJsons $ q32 merg q33 = getFromKeys ["Europa", "America", "Africa", "Australia"] >>> deep getFromArr-ex33 = putJsons $ q33 merg+ex33 = pputJsons $ q33 merg ---------------------------------------------------------------------------- @@ -60,12 +60,12 @@ Right json -> putStrLn $ pprints $ query json ---putJson :: Json -> IO ()-putJson = putStrLn . pprint+pputJson :: Json -> IO ()+pputJson = putStrLn . pprint ---putJsons :: Jsons -> IO ()-putJsons = putStrLn . pprints+pputJsons :: Jsons -> IO ()+pputJsons = putStrLn . pprints -- parse JSON jParse :: String -> Json@@ -75,4 +75,4 @@ pprint = PP.toString " " -pprints js = concat $ intersperse "\n" $ map pprint js --pretty print +pprints js = concat $ intersperse "\n" $ map pprint js
hjson-query.cabal view
@@ -1,5 +1,5 @@ Name: hjson-query-Version: 1.0+Version: 1.0.1 Synopsis: library for querying from JSON Category: Text Description: library(HXT-like) for querying from JSON
src/Text/HJson/Query.hs view
@@ -49,7 +49,9 @@ infixl 1 >>> infixr 2 <+>-infixr 3 -->+infixr 3 <>+infixr 3 <.>+infixr 4 --> -- Building @@ -89,7 +91,7 @@ -- > j6 = jParse"{\"America\": {\"USA\": [], \"Canada\": [\"Toronto\"]}}" -- > j7 = jParse "{\"Australia\": [\"Melburn\", \"Adelaida\"]}" -- > merg = mergsRec [j1, j2, j3, j4, j5, j6, j7]--- > ex0 = putJson merg+-- > ex0 = pputJson merg -- -- Result: --@@ -176,7 +178,7 @@ -- -- > query1 = getFromKeys ["Europa", "America", "Africa"] -- > json1 = query1 merg --- > ex1 = putJsons json1+-- > ex1 = pputJsons json1 -- -- Result: --@@ -225,7 +227,7 @@ -- -- > query2 = query1 >>> getFromObj -- > json2 = query2 merg--- > ex2 = putJsons json2+-- > ex2 = pputJsons json2 -- -- Result: --