Hi, one of my plugins dumps core output to the user, and this core output contains “interesting subexpressions”. I would like to highlight them (for example, with `bold :: SDoc -> SDoc`).
As far as I can see, I have these options: * I copy all, or most of PprCore, and extend ppr_expr to look for the subexpressions that I care about. Obviously not nice, because of a code copy. * I extend GHC to support that. One way would be to add a new constructor to `data Tickish id = … | Highlight` so that I can wrap the interesting subexpressions in `Tick Highlight e`. That’s a bit better, and could even be useful in GHC (e.g. a linter error could highlight the lint error location), but it’d mean waiting for new compiler versions until I can make use of that, and it is still limited to subexpressions – highlighting a binder would require yet another support. * Could we extend SDoc with an operation highlightIn :: SDoc -> SDoc -> SDoc or highlightIn :: Doc -> Doc -> Doc where `highlightIn doc1 doc2` is like doc2, but any subdocument that is “ismorphic to doc1” (for whatever that means) gets highlighted? Are there other options that I might not see right now? Cheers, Joachim -- Joachim Breitner m...@joachim-breitner.de http://www.joachim-breitner.de/
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users