[Haskell-cafe] Haskell syntax inside QuasiQuote

Niklas Broberg niklas.broberg at gmail.com
Tue Oct 28 06:44:26 EDT 2008

On Tue, Oct 28, 2008 at 7:56 AM, Reiner Pope <reiner.pope at gmail.com> wrote:
> I've tried it out and it looks good so far. I had to fiddle with
> haskell-src-ext's .cabal file to get it to install with GHC 6.10,
> which is surprising since it isn't listed as a broken package... ah
> well.

Care to tell me what the problem is? I have no problem installing it
with GHC 6.10, in fact the 0.3.9 version on hackage was uploaded
solely to have it compile with both old and new GHC.

> Unfortunately, I've uncovered a problem in the parser. For instance,
> with your module, [$hs|1+1*2|] evaluates to 4 rather than 3. This
> seems to be a general problem with infix operators, which I believe
> arises since haskell-src-exts isn't given the fixity declarations for
> + and *, so it doesn't know to bind (*) tighter than (+). I don't see
> how this problem can even be resolved without modifying Template
> Haskell: given that the operators reside in user code, there is no way
> to find their fixity.

Yes, you're right, haskell-src(-exts) does not handle fixity of
operators for you. You need to collect the fixities yourself and make
a second pass over expressions to get them right. This is definitely
functionality I would like to see available in haskell-src-exts
(though not on by default), so if anyone were to implement it I would
gladly accept patches.



More information about the Haskell-Cafe mailing list