[Haskell-cafe] how can I get template haskell macro-expanded code
from inferStartState? (repeated post, now with subject)
Brian Brunswick
brian.brunswick at gmail.com
Thu Aug 9 13:28:16 EDT 2007
On 09/08/07, Thomas Hartman <thomas.hartman at db.com> wrote:
>
> (sorry, forgot the subject on my first post)
>
> In the following code which uses template haskell, how can I get back the
> macro-expanded code generated from
>
> $(inferStartState ''MyState)
>
I just recently used ghc -ddump-splices to debug this very same problem.
It turns out to be due to overlapping instances - inferStartState generates
a (from memory) specific StartStateEx instance, but actually theres a general
StartState => StartStateEx, and also a general Monoid=>StartState instance, and
thats why the error message mentions Monoid.
I guess this teaches us the reason that overlapping instances are bad:
***They don't work across modules****
Another module can add an instance which wasn't visible when a first module
was compiled, and the two modules end up using different instances
than expected.
I've been meaning to start trying to contribute to improving the HAppS
documentation, since
its been such a struggle to start learning it.
So the question to the HAppS people is, where is the canonical place
for this documentation, where should one work? Is it the wiki page
above, or the stuff inside the HAppS repository?
--
Brian_Brunswick____brian at ithil.org____Wit____Disclaimer____!Shortsig_rules!
More information about the Haskell-Cafe
mailing list