Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/Language/Haskell/Exts/Pretty.hs
Original file line number Diff line number Diff line change
Expand Up @@ -894,14 +894,25 @@ instance Pretty (Promoted l) where
PromotedCon _ hasQuote qn ->
addQuote hasQuote (pretty qn)
PromotedList _ hasQuote list ->
addQuote hasQuote $ bracketList . punctuate comma . map pretty $ list
addQuote hasQuote $ brackets . addSpace list . prettyList $ list
PromotedTuple _ list ->
addQuote True $ parenList $ map pretty list
addQuote True $ parens . addSpace list . prettyList $ list
PromotedUnit {} -> addQuote True $ text "()"
where
addQuote True doc = char '\'' <> doc
addQuote False doc = doc

checkQuote (PromotedCon _ q _) = q
checkQuote (PromotedList _ q _) = q
checkQuote (PromotedTuple _ _) = True
checkQuote _ = False

addSpace (TyPromoted _ l0:_) | checkQuote l0 = (space <>)
addSpace _ = id

prettyList = myFsepSimple . punctuate comma . map pretty


instance Pretty (TyVarBind l) where
pretty (KindedVar _ var kind) = parens $ myFsep [pretty var, text "::", pretty kind]
pretty (UnkindedVar _ var) = pretty var
Expand Down