Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataKinds: No escaping of type level strings? #470

Open
nomeata opened this issue Apr 24, 2023 · 1 comment
Open

DataKinds: No escaping of type level strings? #470

nomeata opened this issue Apr 24, 2023 · 1 comment

Comments

@nomeata
Copy link

nomeata commented Apr 24, 2023

With this file:

{-# LANGUAGE DataKinds #-}

valueLevelString = "This is a value level string with a \""
type TypLevelString = "This is a type level string with a \""

it seems that prettyPrint does not escape the type level string:

ghci> parseFile "/tmp/Test.hs" >>= putStrLn . prettyPrint . fromParseResult
{-# LANGUAGE DataKinds #-}
valueLevelString = "This is a value level string with a \""

type TypLevelString = "This is a type level string with a ""
@nomeata
Copy link
Author

nomeata commented Apr 24, 2023

This may be enough, unless there is a good reason that I don’t know why this wasn’t already done like this:

diff --git a/src/Language/Haskell/Exts/Pretty.hs b/src/Language/Haskell/Exts/Pretty.hs
index 8d39a2d..ded378b 100644
--- a/src/Language/Haskell/Exts/Pretty.hs
+++ b/src/Language/Haskell/Exts/Pretty.hs
@@ -890,7 +890,7 @@ instance  Pretty (Promoted l) where
   pretty p =
     case p of
       PromotedInteger _ n _ -> integer n
-      PromotedString _ s _ -> doubleQuotes $ text s
+      PromotedString _ s _ -> text (show s)
       PromotedCon _ hasQuote qn ->
         addQuote hasQuote (pretty qn)
       PromotedList _ hasQuote list ->

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant