haskell-src-exts-sc: Pretty print haskell code with comments

[ bsd3, language, library ] [ Propose Tags ]

Generate code from haskell-src-exts AST


[Skip to Readme]
Versions [faq] 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.1.0.4, 0.1.0.5, 0.1.0.6 (info)
Dependencies base (>=4.7 && <5), haskell-src-exts (>=1.18.0), haskell-src-exts-sc [details]
License BSD-3-Clause
Copyright Copyright: (c) 2017 Artem Chirkin
Author Artem Chirkin
Maintainer chirkin@arch.ethz.ch
Category bsd3, library, language
Home page https://github.com/achirkin/haskell-src-exts-sc#readme
Source repo head: git clone https://github.com/achirkin/haskell-src-exts-sc
Uploaded by achirkin at Wed Jan 10 10:43:42 UTC 2018
Distributions NixOS:0.1.0.6
Executables sc-example
Downloads 2336 total (260 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs not available [build log]
All reported builds failed as of 2018-01-10 [all 3 reports]

Modules

  • Language
    • Haskell
      • Exts
        • Language.Haskell.Exts.SimpleComments

Flags

NameDescriptionDefaultType
build-example

Build an example executable.

EnabledAutomatic

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

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for haskell-src-exts-sc-0.1.0.0

[back to package description]

haskell-src-exts-sc

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.