does the order of splice definitions matter in template haskell, or is this a bug?

I have a situation where ... stuff... $(expose ['setState, 'getState] f = SetState compiles but f = SetState $(expose ['setState, 'getState] doesn't compile, with error: Not in scope: data constructor 'SetState. Is this a bug? expose is defined in HAppS.State.EventTH t,. --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Hi Thomas, On Wed, Oct 31, 2007 at 03:27:20PM -0400, Thomas Hartman wrote:
I have a situation where
... stuff...
$(expose ['setState, 'getState] f = SetState
compiles but
f = SetState $(expose ['setState, 'getState]
doesn't compile, with error: Not in scope: data constructor 'SetState.
Is this a bug?
Not if SetState is created by the splice or defined after the splice, no. GHC typechecks up to the splice before running the splice, and then continues typechecking everything past the splice afterwards. So if f is defined before the splice then it must typecheck without the results of the splice (or anything later in the file). Thanks Ian

order matters. But I hope people are transitioning to using mkCommand instead of expose as it provides more functionality. -Alex- Thomas Hartman wrote:
I have a situation where
... stuff...
$(expose ['setState, 'getState] f = SetState
compiles but
f = SetState $(expose ['setState, 'getState]
doesn't compile, with error: Not in scope: data constructor 'SetState.
Is this a bug?
expose is defined in HAppS.State.EventTH
t,. ---
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "HAppS" group. To post to this group, send email to HAppS@googlegroups.com To unsubscribe from this group, send email to HAppS-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/HAppS?hl=en -~----------~----~----~----~------~----~------~--~---
participants (3)
-
Alex Jacobson
-
Ian Lynagh
-
Thomas Hartman