https://github.com/robrix/language-haskell-ast
Generic interface over the AST provided by haskell-src-exts
https://github.com/robrix/language-haskell-ast
Last synced: 4 months ago
JSON representation
Generic interface over the AST provided by haskell-src-exts
- Host: GitHub
- URL: https://github.com/robrix/language-haskell-ast
- Owner: robrix
- License: bsd-3-clause
- Created: 2016-08-28T14:00:38.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-08-28T14:14:06.000Z (almost 10 years ago)
- Last Synced: 2025-10-11T12:38:59.085Z (8 months ago)
- Language: Haskell
- Size: 71.3 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# language-haskell-ast
[`haskell-src-exts`](https://hackage.haskell.org/package/haskell-src-exts)’s parser produces AST modelled in a number of concrete, specific datatypes. This is a good thing for most purposes, but it also means that some simple tasks like walking the tree to e.g. count the nodes requires writing code for each specific type.
`language-haskell-ast` adds generic interfaces for this sort of walk. It also knows how to pretty-print the AST as s-expressions, if you like that sort of thing.
For example, here’s the AST for the first couple of lines of the program which produces the AST:
```
$ language-haskell-ast app/Main.hs
(Module (ModuleHead (ModuleName "Main"))
(LanguagePragma (Ident "DefaultSignatures")
(Ident "FlexibleContexts")
(Ident "FlexibleInstances")
(Ident "RecordWildCards")
(Ident "TypeOperators"))
…
```
…and so on.