Replace ansi-wl-print with prettyprinter#92
Replace ansi-wl-print with prettyprinter#929999years wants to merge 2 commits intohaskellari:masterfrom
ansi-wl-print with prettyprinter#92Conversation
The `ansi-wl-pprint` changelog for 1.0.2 says that "Using `show` won't preserve formatting anymore, as `prettyprinter`s `Show Doc` instance is annotation invariant." This patch applies their suggested workaround, `Text.unpack . renderLazy . layoutPretty defaultLayoutOptions`. See: https://github.com/ekmett/ansi-wl-pprint/blob/master/Changelog.md#102
phadej
left a comment
There was a problem hiding this comment.
Apparently this also replaces pretty with prettyprinter, not only ansi-wl-pprint with prettyprinter directly. Why?
| wrt expr = BS.writeFile fp $ TE.encodeUtf8 $ T.pack $ showWL (WL.plain (ansiWlExpr expr)) ++ "\n" | ||
|
|
||
| showWL :: WL.Doc -> String | ||
| showWL doc = WL.displayS (WL.renderSmart 0.4 80 doc) "" |
There was a problem hiding this comment.
why this change. AFAICT (by using this package very day), ediffGolden colors output?
There was a problem hiding this comment.
Correct, there's no change in behavior here. There's a small change in the implementation because the prettyprint libraries have a different interface than the ansi-wl-pprint compatibility layer.
| (setSGRCode [Reset] ++ render (ansiWlEditExpr $ ediff x y)) | ||
| (x == y) | ||
| where | ||
| render = TL.unpack . renderLazy . layoutPretty defaultLayoutOptions |
There was a problem hiding this comment.
AFAICT, this is the only relevant change, properties are not coloured with prettyprinter. If so, this is the only relevant change.
There was a problem hiding this comment.
Yes, #91 includes only this change, which is why I linked to it in #77 (comment).
|
|
|
That's correct, but |
This builds off of #91.
The workaround for #91 requires adding the
prettyprinterandprettyprinter-ansi-terminalpackages anyways, so let's remove the deprecatedansi-wl-print.