summaryrefslogtreecommitdiff
path: root/src/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 4da2295..2e4ee7a 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -2,7 +2,7 @@ module Main where
import Control.Monad (forM_)
import Control.Monad.Identity (Identity)
-import Data.Aeson (Value (..), encode)
+import Data.Aeson (ToJSON (..), Value (..), encode)
import qualified Data.ByteString.Lazy.Char8 as BL
import qualified Data.Text as Text
import qualified Data.Text.IO as TextIO
@@ -138,7 +138,7 @@ processCompilationResult ma =
encode $
alterGenericSyntaxTree cleanupIdentifiers $
toGenericSyntaxTree $
- fmap (Just . String . Text.pack . show) ast
+ fmap (Just . toJSON) ast
return ExitSuccess
Nothing -> do
putStrLn "\x1b[1;31mCompilation Failed\x1b[0m"
@@ -155,7 +155,7 @@ handleParsingFailure diags = do
cleanupIdentifiers :: GenericSyntaxTree Identity a -> Maybe (GenericSyntaxTree Identity a)
cleanupIdentifiers (SyntaxTreeObject _ _ _ tr)
| Just (Identifier n _) <- castT tr =
- Just $ SyntaxTreeValue (Text.unpack n)
+ Just $ SyntaxTreeValue (String n)
where
castT :: (Typeable t, Typeable f, Typeable a, Typeable t') => t f a -> Maybe (t' f a)
castT = cast