ANNOUNCE: antiquoter-0.1.0.0

Hello cafe, I'm happy to announce the release of my first package antiquoter [1], a combinator library for writing quasiquoters and antiquoters. The main aim is to simplify their definitions and reduce copy-and-paste programming. The main feature the current version is trying to solve is code duplication in antiquoters. The problem for writing antiquoters is that it need to be done twice, once for use as an expression and once for use as a pattern. These two implementations are very similar, which leads to copy-and-paste programming. For a good example of what this leads to see the antiquoters of language-c-quote[2], where almost every antiquoter is written twice. A very simple example with the rewritten version is provided in the documentation [3]. Lars [1]:http://hackage.haskell.org/package/antiquoter [2]: http://hackage.haskell.org/packages/archive/language-c-quote/0.7.1/doc/html/... [3]: http://hackage.haskell.org/packages/archive/antiquoter/0.1.0.0/doc/html/Lang... [4]:https://github.com/Laar/antiquoter

Hi, L Corbijn wrote:
I'm happy to announce the release of my first package antiquoter, a combinator library for writing quasiquoters and antiquoters. The main aim is to simplify their definitions and reduce copy-and-paste programming.
Very interesting. I'm using something similar to your EP class, but yours looks more refined. See class PatOrExp in https://github.com/Toxaris/pts/blob/master/src-lib/PTS/QuasiQuote.hs I'm a bit overwhelmed by the rest of your library, though. Is the overall design explained somewhere? And: Your package description says that it is "especially aimed at making user extensible antiquoters". That sounds very cool. Can you provide an example for how the antiquoter package supports extensions, and what kinds of extensions are supported? Tillmann

Hi, A late reply, I was a bit busy. My comments are inline On Thu, Apr 4, 2013 at 7:30 PM, Tillmann Rendel < rendel@informatik.uni-marburg.de> wrote:
Hi,
L Corbijn wrote:
I'm happy to announce the release of my first package antiquoter, a
combinator library for writing quasiquoters and antiquoters. The main aim is to simplify their definitions and reduce copy-and-paste programming.
Very interesting. I'm using something similar to your EP class, but yours looks more refined. See class PatOrExp in https://github.com/Toxaris/pts/blob/master/src-lib/PTS/QuasiQuote.hs
That looks interesting. Maybe I should include your version of Lift, to extend the version of template-haskell to also work on patterns.
I'm a bit overwhelmed by the rest of your library, though. Is the overall design explained somewhere?
It isn't really explained somewhere, so I should update the documentation with it. The basic idea is that you build an AntiQuoter out of separate AntiQuoterPass-es using (<<>) or (<>>). The resulting AntiQuoter can then be used by dataToExpQ/dataToPatQ to form the total QuasiQuote, or using the helper function mkQuasiQuoter. The pattern-expression similarity is build is build on top of this abstraction, where the result of the AntiQuoter(Pass) is fixed to any instance of the EP class. Which are then used to define quite a few combinators. Anyway, I'll try to update the documentation soon to make the design a bit clearer.
And: Your package description says that it is "especially aimed at making user extensible antiquoters". That sounds very cool. Can you provide an example for how the antiquoter package supports extensions, and what kinds of extensions are supported?
That aim should have been removed as it still is not done. But let me put it into context. The package started of as some reusable parts which I got from refactoring haskell-src-exts-qq. Its quasiquoter has three patterns to get something antiquoted each with their own special use cases. The problem was that I wanted something antiquoted which could not be done in one of those three patterns. Adding a fourth pattern has its problems, so I started antiquoter with one of the aims being to make antiquoters extensible by the user. I think I have got some ideas of how to do this, but I didn't find the time to add them. Lars
Tillmann
participants (2)
-
L Corbijn
-
Tillmann Rendel