[Haskell-cafe] TH error
newsham at lava.net
Fri Sep 26 22:33:54 EDT 2008
I'm goofing with TH and I have my program mostly done:
If I have the "$(deriveBinary ''MyData)" line commented out it
prints out what looks to me like correct code. I can even paste
it into a program and it compiles. However, when the line isn't
commented out I get an error I don't understand:
Illegal data constructor name: `x'
When splicing generated code into the program
There are two places in my code I use "x" in splices that could
be causing the problem:
g <- [| getWord8 >>= \x -> $(caseE [| x |] gcases') |]
put x = $(caseE [| x |] (map return ps)) |]
but I don't understand why these might be causing errors (if they
are indeed the cause). Using -ddump-splices doesn't help since
it seems to hit the error before dumping splices.
What's going on here?
More information about the Haskell-Cafe