Changes to enable usage of prettyprinter backends#73
Changes to enable usage of prettyprinter backends#73georgefst merged 3 commits intocdepillabout:masterfrom georgefst:expose-pp-internals
Conversation
This makes it feasible to use pretty-simple with any prettyprinter backend.
| -- Used by 'Simple.pString' etc. | ||
| layoutString :: OutputOptions -> String -> SimpleDocStream AnsiStyle | ||
| layoutString :: OutputOptions -> String -> SimpleDocStream Style | ||
| layoutString opts = |
There was a problem hiding this comment.
Perhaps we should actually document this functionality properly, and expose this function from a non-Internal module?
| colorDullMagenta = colorDull Magenta | ||
|
|
||
| colorDullRed :: AnsiStyle | ||
| colorDullRed = colorDull Red |
There was a problem hiding this comment.
I may have gone overboard in removing things from this module. But with this more user-friendly colour type (previously it was just Builder), it seems a bit pointless to export all these combinations.
| import Prettyprinter (SimpleDocStream) | ||
| import Prettyprinter.Render.Terminal | ||
| (Color (..), Intensity(Vivid,Dull), AnsiStyle, | ||
| renderLazy, renderIO) |
There was a problem hiding this comment.
I haven't quite been able to work out the formatting rules for imports. Do you use a particular formatter?
There was a problem hiding this comment.
hindent used to format imports like this (but now it has been changed to format import lists differently).
However, if you want to change this (or even run a formatter over all the code), please feel free.
|
There are a few missing Haddocks. I'll add those once everything else is approved. |
|
@georgefst You've been doing a bunch of work on Would you be interested in become a maintainer of I've been pretty busy at work lately, and I haven't had time to take a good look at your last couple PRs. |
That would be great. If you're happy not to review the current PRs in detail, then I'll clean them up and merge. I'd still feel more comfortable checking in with you for at least a high-level overview of changes before publishing a release (and I really don't mind waiting a while for that if necessary). |
|
@georgefst I sent you an invitation to be a collaborator for this repo. I think you should get an email from github about it. Also, if you send me your hackage username, I'll add you as a maintainer on Hackage.
I'd definitely be fine with checking for a high-level overview of changes, although you can feel free to go ahead and merge stuff yourself, as well as review/merge PRs from other users. For making a release to Hackage, I have a checklist: https://functor.tokyo/blog/2018-07-16-release-haskell-packages-to-hackage Most of these should be pretty obvious, but the two important points are to make sure to update the As far as the long-term vision for
|
|
I took a quick look at this, and I'm happy with it if you want to merge it in! |
|
@cdepillabout I'm GeorgeThomas on Hackage. |
|
Thanks, I've added you on Hackage: https://hackage.haskell.org/package/pretty-simple/maintainers/ |
Using
prettyprinter-ansi-terminal'sAnsiStyleto represent colours was not ideal as it is intentionally opaque, and so it's difficult to convert to another format.This PR introduces a new
Styletype corresponding to the subset ofAnsiStylewhich is used inpretty-simple.There is some inconsistency in whether we refer to things as "style"s or "colour"s. This
Styletype allows customising whether the text is bold, so it does represent more than just colour. But changing all instances of "color" to "style" would seem an unnecessary break of backwards compatibility. This isn't really a new issue, but this change has made it more obvious.