Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions copilot-prettyprinter/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
2024-08-30
* Add support for pretty-printing struct update expressions. (#526)

2024-07-07
* Version bump (3.20). (#522)

Expand Down
3 changes: 3 additions & 0 deletions copilot-prettyprinter/src/Copilot/PrettyPrint.hs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ ppOp2 op = case op of
BwShiftL _ _ -> ppInfix "<<"
BwShiftR _ _ -> ppInfix ">>"
Index _ -> ppInfix ".!!"
UpdateField (Struct _) _ f -> \ doc1 doc2 ->
parens $ doc1 <+> text "##" <+> text (accessorName f) <+> text "=:" <+> doc2
UpdateField _ _ _ -> impossible "ppOp2" "Copilot.PrettyPrint"

-- | Pretty-print a ternary operation.
ppOp3 :: Op3 a b c d -> Doc -> Doc -> Doc -> Doc
Expand Down