dhall-json 1.7.7 → 1.7.8
raw patch · 7 files changed
+45/−36 lines, 7 filesdep ~dhallPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: dhall
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- dhall-json.cabal +2/−3
- json-to-dhall/Main.hs +3/−33
- src/Dhall/JSON.hs +20/−0
- tasty/Main.hs +1/−0
- tasty/data/time.dhall +7/−0
- tasty/data/time.json +8/−0
CHANGELOG.md view
@@ -1,3 +1,7 @@+1.7.8++* [Add support for `Date` / `Time` / `TimeZone`](https://github.com/dhall-lang/dhall-haskell/pull/2247)+ 1.7.7 * Build against `dhall-1.39.0`
dhall-json.cabal view
@@ -1,8 +1,7 @@ Name: dhall-json-Version: 1.7.7+Version: 1.7.8 Cabal-Version: >=1.10 Build-Type: Simple-Tested-With: GHC == 8.4.3, GHC == 8.6.1 License: BSD3 License-File: LICENSE Copyright: 2017 Gabriel Gonzalez@@ -44,7 +43,7 @@ aeson-yaml >= 1.1.0 && < 1.2 , bytestring < 0.12, containers >= 0.5.9 && < 0.7 ,- dhall >= 1.39.0 && < 1.40,+ dhall >= 1.40.0 && < 1.41, exceptions >= 0.8.3 && < 0.11, filepath < 1.5 , lens-family-core >= 1.0.0 && < 2.2 ,
json-to-dhall/Main.hs view
@@ -17,16 +17,11 @@ import qualified Control.Exception import qualified Data.Aeson as Aeson import qualified Data.ByteString.Lazy.Char8 as ByteString-import qualified Data.Text.IO as Text.IO-import qualified Data.Text.Prettyprint.Doc as Pretty-import qualified Data.Text.Prettyprint.Doc.Render.Terminal as Pretty.Terminal-import qualified Data.Text.Prettyprint.Doc.Render.Text as Pretty.Text import qualified Dhall.Core-import qualified Dhall.Pretty+import qualified Dhall.Util import qualified GHC.IO.Encoding import qualified Options.Applicative as Options import qualified Paths_dhall_json as Meta-import qualified System.Console.ANSI as ANSI import qualified System.Exit import qualified System.IO as IO @@ -161,31 +156,6 @@ typeCheckSchemaExpr id finalSchema - let renderExpression characterSet plain output expression = do- let document =- Dhall.Pretty.prettyCharacterSet characterSet expression-- let stream = Dhall.Pretty.layout document-- case output of- Nothing -> do- supportsANSI <- ANSI.hSupportsANSI IO.stdout-- let ansiStream =- if supportsANSI && not plain- then fmap Dhall.Pretty.annToAnsiStyle stream- else Pretty.unAnnotateS stream-- Pretty.Terminal.renderIO IO.stdout ansiStream-- Text.IO.putStrLn ""-- Just file_ ->- IO.withFile file_ IO.WriteMode $ \h -> do- Pretty.Text.renderIO h stream-- Text.IO.hPutStrLn h ""- case options of Version -> putStrLn (showVersion Meta.version)@@ -200,7 +170,7 @@ expression <- Dhall.Core.throws (dhallFromJSON conversion finalSchema value) - renderExpression characterSet plain output expression+ Dhall.Util.renderExpression characterSet plain output expression Type{..} -> do let characterSet = toCharacterSet ascii@@ -210,7 +180,7 @@ finalSchema <- toSchema Nothing value - renderExpression characterSet plain output finalSchema+ Dhall.Util.renderExpression characterSet plain output finalSchema handle :: IO a -> IO a handle = Control.Exception.handle handler
src/Dhall/JSON.hs view
@@ -430,6 +430,8 @@ -- -- See: https://github.com/dhall-lang/dhall-lang/issues/492 Core.None -> Left BareNone+ _ | Just text <- Dhall.Pretty.temporalToText e ->+ loop (Core.TextLit (Core.Chunks [] text)) Core.RecordLit a -> case toOrderedList a of [ ( "contents"@@ -881,6 +883,24 @@ Core.TextShow -> Core.TextShow++ Core.Date ->+ Core.Date++ Core.DateLiteral d ->+ Core.DateLiteral d++ Core.Time ->+ Core.Time++ Core.TimeLiteral t p ->+ Core.TimeLiteral t p++ Core.TimeZone ->+ Core.TimeZone++ Core.TimeZoneLiteral z ->+ Core.TimeZoneLiteral z Core.List -> Core.List
tasty/Main.hs view
@@ -57,6 +57,7 @@ , testDhallToJSON "./tasty/data/nesting3" , testDhallToJSON "./tasty/data/nestingLegacy0" , testDhallToJSON "./tasty/data/nestingLegacy1"+ , testDhallToJSON "./tasty/data/time" ] , Test.Tasty.testGroup "Union keys" [ testJSONToDhall "./tasty/data/unionKeys"
+ tasty/data/time.dhall view
@@ -0,0 +1,7 @@+{ example0 = 2020-01-01+, example1 = 00:00:00+, example2 = +00:00+, example3 = 2020-01-01T00:00:00+, example4 = 00:00:00+00:00+, example5 = 2020-01-01T00:00:00+00:00+}
+ tasty/data/time.json view
@@ -0,0 +1,8 @@+{+ "example0": "2020-01-01",+ "example1": "00:00:00",+ "example2": "+00:00",+ "example3": "2020-01-01T00:00:00",+ "example4": "00:00:00+00:00",+ "example5": "2020-01-01T00:00:00+00:00"+}