You're in luck! This is something I've wanted to implement before in the past, and your email reminded me. While pretty awful, it could be used for doing some interesting value-interception instrumentation in Haskell. Recently I've been messing with TH a lot, so this initial implementation was rather straightforward.
https://github.com/mgsloan/overload-app/blob/master/src/Language/Haskell/TH/OverloadApp.hs Usage: https://github.com/mgsloan/overload-app/blob/master/examples/Example1.hs Note: Relatively untested implementation, let me know if you find any problems! It only does this transformation to direct function application, unfortunately. In order to properly overload apply for infix operators, you'll need to be able to resolve fixities at compile time. This could be done by using the code in http://hackage.haskell.org/trac/haskell-prime/wiki/FixityResolution and using the fixity information yielded by TH's "reify". Someone aught to have done this before, but I haven't seen it. Handling the applications involved in do-notation, comprehensions, enumerations, and anything else that's such direct syntax sugar would also be a bit of work (but could be very useful for other TH quasiquoting stuff!). You might also be interested in this: http://hackage.haskell.org/package/zeroth-2009.6.23.3 Hope that helps! -Michael Sloan On Wed, Apr 18, 2012 at 9:49 AM, Ismael Figueroa Palet <ifiguer...@gmail.com> wrote: > I'm working on getting annotated versions of all instances of a function of > a typeclass, and was wondering what are the relation/differences between > Template Haskell and the Rewrite Rules section. Of course this is specific > to GHC. > > Another question, in Racket, primitive function application is denoted > #%app. And using macros I can re-export #%app to be a different function f, > so a program: > > (g a) is rewritten into (f g a) > > is there a way to do the same thing using TH or Rewrite Rules? > > Thanks > > -- > Ismael > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe