From 35ea0df18d7f6716975337de43320788360823fa Mon Sep 17 00:00:00 2001 From: Jan Mas Rovira Date: Wed, 24 May 2023 19:09:48 +0200 Subject: [PATCH] show unicode characters without escaping --- package.yaml | 1 + src/Juvix/Data/CodeAnn.hs | 2 +- src/Juvix/Prelude/Base.hs | 2 ++ tests/positive/Format.juvix | 5 +++++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/package.yaml b/package.yaml index 8492caa745..10b3553d03 100644 --- a/package.yaml +++ b/package.yaml @@ -70,6 +70,7 @@ dependencies: - th-utilities == 0.2.* - time == 1.11.* - transformers == 0.5.* + - unicode-show == 0.1.* - uniplate == 1.6.* - unix-compat == 0.5.* - unordered-containers == 0.2.* diff --git a/src/Juvix/Data/CodeAnn.hs b/src/Juvix/Data/CodeAnn.hs index 838d854aaa..4990945d1f 100644 --- a/src/Juvix/Data/CodeAnn.hs +++ b/src/Juvix/Data/CodeAnn.hs @@ -251,7 +251,7 @@ endSemicolon :: Doc Ann -> Doc Ann endSemicolon x = x <> kwSemicolon ppStringLit :: Text -> Doc Ann -ppStringLit = annotate AnnLiteralString . pretty @Text . show +ppStringLit = annotate AnnLiteralString . pretty . pack . urecover . show bracesIndent :: Doc Ann -> Doc Ann bracesIndent = braces . blockIndent diff --git a/src/Juvix/Prelude/Base.hs b/src/Juvix/Prelude/Base.hs index baee5c2711..4d2df7bfa3 100644 --- a/src/Juvix/Prelude/Base.hs +++ b/src/Juvix/Prelude/Base.hs @@ -8,6 +8,7 @@ module Juvix.Prelude.Base ( module Juvix.Prelude.Base, module Control.Applicative, module Data.Graph, + module Text.Show.Unicode, module Data.Map.Strict, module Data.Set, module Data.IntMap.Strict, @@ -188,6 +189,7 @@ import System.IO.Error import Text.Read qualified as Text import Text.Show (Show) import Text.Show qualified as Show +import Text.Show.Unicode (ushow, urecover) import Prelude (Double) -------------------------------------------------------------------------------- diff --git a/tests/positive/Format.juvix b/tests/positive/Format.juvix index 91b7712b99..4dc21d7379 100644 --- a/tests/positive/Format.juvix +++ b/tests/positive/Format.juvix @@ -158,6 +158,11 @@ end; import Stdlib.Prelude open using {Nat as Natural}; +module UnicodeStrings; + a : String; + a := "λ"; +end; + module Comments; axiom a1 : Type; -- attached to a1