The haskell-src-exts-sc package

[ Tags: bsd3, language, library ] [ Propose Tags ]

Generate code from haskell-src-exts AST. To do it, I pretty print and parse AST, then adjust it to insert comments.

[Skip to Readme]


Versions,,,,, (info)
Dependencies base (>=4.7 && <5), haskell-src-exts (>=1.18.0), haskell-src-exts-sc [details]
License BSD3
Copyright Copyright: (c) 2018 Artem Chirkin
Author Artem Chirkin
Category bsd3, library, language
Home page
Source repo head: git clone
Uploaded Fri Jan 12 09:20:43 UTC 2018 by achirkin
Distributions NixOS:
Executables sc-example
Downloads 272 total (57 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-01-13 [all 1 reports]
Hackage Matrix CI





Build an example executable.


Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


Maintainer's Corner

For package maintainers and hackage trustees

Readme for haskell-src-exts-sc-

[back to package description]


The library generates code from haskell-src-exts AST. The procedure is as follows:

  1. pretty-print AST generated by haskell-src-exts
  2. parse the generated code to get SrcSpanInfo for each node
  3. combine AST annotated with comments and AST annotated with SrcSpanInfo
  4. insert (non-empty) comments into each node, updating SrcSpanInfo of all nodes
  5. profit!

As you can see, the algorithm is nor remarkably fast, because it prints and parses code and modifies SrcSpanInfo of all nodes in an AST on each comment insertion. On the good side, it is quite flexible and compatible with many versions of haskell-src-exts. Performance is also acceptable if you don't need to invoke it every millisecond.