We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This file:
{-# LANGUAGE DataKinds #-} type PromotedList = '[ 'True ]
is pretty-printed as such:
ghci> parseFile "/tmp/Test.hs" >>= putStrLn . prettyPrint . fromParseResult {-# LANGUAGE DataKinds #-} type PromotedList = '['True]
but that’s not legal:
/tmp/Test.hs:3:21: error: parse error on input ‘'’ | 3 | type PromotedList = '['True] | ^
My suggestion to is to always add a space after '[ in the pretty printer.
'[
The text was updated successfully, but these errors were encountered:
I’m locally experimenting with this patch, but there are different ways of structuring this code:
diff --git a/src/Language/Haskell/Exts/Pretty.hs b/src/Language/Haskell/Exts/Pretty.hs index 8d39a2d..6915d44 100644 --- a/src/Language/Haskell/Exts/Pretty.hs +++ b/src/Language/Haskell/Exts/Pretty.hs @@ -890,11 +890,11 @@ 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 -> - addQuote hasQuote $ bracketList . punctuate comma . map pretty $ list + (if hasQuote then quoteBracketList else bracketList) . punctuate comma . map pretty $ list PromotedTuple _ list -> addQuote True $ parenList $ map pretty list PromotedUnit {} -> addQuote True $ text "()" @@ -1450,6 +1450,10 @@ braceList = braces . myFsepSimple . punctuate comma bracketList :: [Doc] -> Doc bracketList = brackets . myFsepSimple +quoteBracketList :: [Doc] -> Doc +quoteBracketList [] = text "'[]" +quoteBracketList l = char '\'' <> brackets (space <> myFsepSimple l) + bracketColonList :: [Doc] -> Doc bracketColonList = bracketColons . myFsepSimple where bracketColons = brackets . colons
Sorry, something went wrong.
No branches or pull requests
This file:
is pretty-printed as such:
but that’s not legal:
My suggestion to is to always add a space after
'[
in the pretty printer.The text was updated successfully, but these errors were encountered: