[Haskell-cafe] some questions about Template Haskell
paratribulations at free.fr
Sat Jun 29 22:03:51 CEST 2013
> 2/ If I define in a module:
> j = 3
> and then define in another module:
> h x = $([|j|])
> main = do
> print $ h undefined
> I obtain "3" as expected.
> However, I do not achieve to make this system work with an infix
> infix $([| j |]) +
> I obtain:
> parse error on input `$('
I don't know what happens exactly, but one way to get out of this problem is
to write the complete top-level declaration with a splice, instead of only
the fixity level:
$(return $ [ InfixD (Fixity $([| j |]) InfixN) (mkName "+") ])
Concerning my first question, I have not been able to understand what
happens at this time. I continue to look at it.
More information about the Haskell-Cafe