summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabrielGonzalez <>2017-12-02 02:42:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2017-12-02 02:42:00 (GMT)
commit989c2431c382af52ee7d2ab5d7550bdfd7537226 (patch)
tree2fb7fe04878750e2fe30fd08728df7b831f38523
parentab20f474c0dff68f2730b302c995022e2c67eadd (diff)
version 1.0.91.0.9
-rw-r--r--dhall-json.cabal11
-rw-r--r--dhall-to-json/Main.hs4
-rw-r--r--src/Dhall/JSON.hs22
3 files changed, 17 insertions, 20 deletions
diff --git a/dhall-json.cabal b/dhall-json.cabal
index dbc6fa3..22641c7 100644
--- a/dhall-json.cabal
+++ b/dhall-json.cabal
@@ -1,5 +1,5 @@
Name: dhall-json
-Version: 1.0.8
+Version: 1.0.9
Cabal-Version: >=1.8.0.2
Build-Type: Simple
Tested-With: GHC == 7.10.2, GHC == 8.0.1
@@ -29,11 +29,10 @@ Source-Repository head
Library
Hs-Source-Dirs: src
Build-Depends:
- base >= 4.8.0.0 && < 5 ,
- aeson >= 1.0.0.0 && < 1.3,
- dhall >= 1.0.1 && < 1.9,
- neat-interpolation < 0.4,
- text >= 0.11.1.0 && < 1.3,
+ base >= 4.8.0.0 && < 5 ,
+ aeson >= 1.0.0.0 && < 1.3,
+ dhall >= 1.0.1 && < 1.9,
+ text >= 0.11.1.0 && < 1.3,
vector
Exposed-Modules: Dhall.JSON
GHC-Options: -Wall
diff --git a/dhall-to-json/Main.hs b/dhall-to-json/Main.hs
index 4aec049..8258f4c 100644
--- a/dhall-to-json/Main.hs
+++ b/dhall-to-json/Main.hs
@@ -14,7 +14,7 @@ import Text.Trifecta.Delta (Delta(..))
import qualified Control.Exception
import qualified Data.Aeson
import qualified Data.Aeson.Encode.Pretty
-import qualified Data.ByteString.Lazy
+import qualified Data.ByteString.Lazy.Char8
import qualified Data.Text.Lazy.IO
import qualified Dhall
import qualified Dhall.Import
@@ -56,7 +56,7 @@ main = handle (do
if Options.Generic.unHelpful pretty
then Data.Aeson.Encode.Pretty.encodePretty
else Data.Aeson.encode
- Data.ByteString.Lazy.putStr (encode json) ))
+ Data.ByteString.Lazy.Char8.putStrLn (encode json) ))
handle :: IO a -> IO a
handle = Control.Exception.handle handler
diff --git a/src/Dhall/JSON.hs b/src/Dhall/JSON.hs
index 1a6ae80..9e8b619 100644
--- a/src/Dhall/JSON.hs
+++ b/src/Dhall/JSON.hs
@@ -1,6 +1,5 @@
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE QuasiQuotes #-}
{-| This library only exports a single `dhallToJSON` function for translating a
Dhall syntax tree to a JSON syntax tree (i.e. a `Value`) for the @aeson@
@@ -107,6 +106,7 @@ module Dhall.JSON (
import Control.Exception (Exception)
import Data.Aeson (Value)
+import Data.Monoid ((<>))
import Data.Typeable (Typeable)
import Dhall.Core (Expr)
import Dhall.TypeCheck (X)
@@ -117,7 +117,6 @@ import qualified Data.Text.Lazy
import qualified Data.Text.Lazy.Builder
import qualified Data.Vector
import qualified Dhall.Core
-import qualified NeatInterpolation
{-| This is the exception type for errors that might arise when translating
Dhall to JSON
@@ -129,16 +128,15 @@ data CompileError = Unsupported (Expr X X) deriving (Typeable)
instance Show CompileError where
show (Unsupported e) =
- Data.Text.unpack [NeatInterpolation.text|
-$_ERROR: Cannot translate 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:
-
-↳ $txt
-|]
+ Data.Text.unpack $
+ "" <> _ERROR <> ": Cannot translate to JSON \n\
+ \ \n\
+ \Explanation: Only primitive values, records, unions, ❰List❱s, and ❰Optional❱ \n\
+ \values can be translated from Dhall to JSON \n\
+ \ \n\
+ \The following Dhall expression could not be translated to JSON: \n\
+ \ \n\
+ \↳ " <> txt <> " "
where
txt = Data.Text.Lazy.toStrict (Dhall.Core.pretty e)