[Haskell-cafe] TemplateHaskell forces manual declaration ordering?

Michael Alan Dorman mdorman at ironicdesign.com
Tue May 20 11:57:52 UTC 2014


"edwardsbenj at gmail.com" <edwards.benj at gmail.com> writes:
> This is a known limitation. You can't refer to items in splices that
> haven't already been mentioned in the source. I don't know why it isn't
> (prominently) documented, it's definitely part of the folklore.

I'm sure this limitation is documented, I was just oblivious to its
implications---naively, the fact that my data declaration wasn't being
created by the splice would have seemed to exclude it from
consideration.

However, your explanation helped me think through the implications, at
which point it makes perfect sense---it's not that the declaration is
created by the splice, but that it is used in the splice, and must thus
be amenable to being fully traversed at the point of the splice, else
the splice can't complete its job and compilation can't continue.

Thanks again,

Mike.


More information about the Haskell-Cafe mailing list