packages feed

dhall-json 1.0.1 → 1.0.2

raw patch · 2 files changed

+28/−9 lines, 2 filesdep ~dhallPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: dhall

API changes (from Hackage documentation)

Files

dhall-json.cabal view
@@ -1,5 +1,5 @@ Name: dhall-json-Version: 1.0.1+Version: 1.0.2 Cabal-Version: >=1.8.0.2 Build-Type: Simple Tested-With: GHC == 7.10.2, GHC == 8.0.1@@ -31,7 +31,7 @@     Build-Depends:         base               >= 4.8.0.0  && < 5  ,         aeson              >= 1.0.0.0  && < 1.2,-        dhall              >= 1.0.1    && < 1.3,+        dhall              >= 1.0.1    && < 1.4,         neat-interpolation                < 0.4,         text               >= 0.11.1.0 && < 1.3,         vector@@ -45,7 +45,7 @@         base             >= 4.8.0.0  && < 5   ,         aeson            >= 1.0.0.0  && < 1.2 ,         bytestring                      < 0.11,-        dhall            >= 1.0.1    && < 1.3 ,+        dhall            >= 1.0.1    && < 1.4 ,         dhall-json                            ,         optparse-generic >= 1.1.1    && < 1.2 ,         trifecta         >= 1.6      && < 1.7 ,@@ -58,7 +58,7 @@     Build-Depends:         base             >= 4.8.0.0  && < 5   ,         bytestring                      < 0.11,-        dhall            >= 1.0.1    && < 1.3 ,+        dhall            >= 1.0.1    && < 1.4 ,         dhall-json                            ,         optparse-generic >= 1.1.1    && < 1.2 ,         trifecta         >= 1.6      && < 1.7 ,
src/Dhall/JSON.hs view
@@ -27,6 +27,7 @@     * @Text@     * @List@s     * @Optional@ values+    * unions     * records      Dhall @Bool@s translate to JSON bools:@@ -68,10 +69,27 @@ > $ dhall-to-json <<< '{ foo = 1, bar = True }' > {"foo":1,"bar":true} -    Note that you cannot convert Dhall unions since JSON does not support sum-    types.  You will need to convert your unions to use the above types within-    Dhall before translating to JSON+    Dhall unions translate to the wrapped value: +> $ dhall-to-json <<< "< Left = +2 | Right : Natural>"+> 2+> $ cat config+> [ < Person = { age = +47, name = "John" }+>   | Place  : { location : Text }+>   >+> , < Place  = { location = "North Pole" }+>   | Person : { age : Natural, name : Text }+>   >+> , < Place  = { location = "Sahara Desert" }+>   | Person : { age : Natural, name : Text }+>   >+> , < Person = { age = +35, name = "Alice" }+>   | Place  : { location : Text }+>   >+> ]+> $ dhall-to-json <<< "./config"+> [{"age":47,"name":"John"},{"location":"North Pole"},{"location":"Sahara Desert"},{"age":35,"name":"Alice"}]+     Also, all Dhall expressions are normalized before translation to JSON:  > $ dhall-to-json <<< "True == False"@@ -114,8 +132,8 @@         Data.Text.unpack [NeatInterpolation.text| $_ERROR: Cannot translate to JSON -Explanation: Only primitive values, records, ❰List❱s, and ❰Optional❱ values can-be translated from Dhall to JSON+Explanation: Only primitive values, records, unions, ❰List❱s, and ❰Optional❱+values can be translated from Dhall to JSON  The following Dhall expression could not be translated to JSON: @@ -161,4 +179,5 @@         Dhall.Core.RecordLit a -> do             a' <- traverse loop a             return (Data.Aeson.toJSON a')+        Dhall.Core.UnionLit _ b _ -> loop b         _ -> Left (Unsupported e)