[Haskell-cafe] ANN: th-desugar simplifies Template Haskell processing
Richard Eisenberg
eir at cis.upenn.edu
Fri Aug 30 02:08:12 CEST 2013
I've just uploaded my new th-desugar package, which enables easier processing of Template Haskell source syntax by desugaring it into a much simpler core language. The meaning of the code after desugaring is identical to before desugaring, but the syntax is much simpler. To wit, th-desugar simplifies out all of the following constructs:
- guarded expressions in both functions and case statements
- "where" declarations
- do syntax
- list/monad comprehensions
- record creation / updates
- as patterns
- non-trivial patterns in a lambda expression
- lambda-case
- multi-way if
- several more
If you are writing a library that manipulates Template Haskell syntax, you may wish to consider if th-desugar will make your job easier by forcing you to consider fewer cases. The one source Haskell construct supported by Template Haskell but not supported by th-desguar is view patterns, mostly because these interact quite non-trivially with pattern binders. It's possible this hole will be closed in a future version.
Enjoy!
Richard
More information about the Haskell-Cafe
mailing list