
Hey, I've attached a file that fails to compile, resulting in a "not in scope: getHomeR" error message. The culprit seems to be the mkPersist TH splice, which, when ocurring before the getHomeR view, causes it to not be seen by GHC when it parses the mkYesod splice. Moving the mkPersist splice to occur after the getHomeR view will alleviate this problem, but then one can't use the data constructors that mkPersist generates within the getHomeR view. Moving the mkPersist splice into a seperate module and importing that works perfectly fine, however. Can anyone clarify what is going on?

Basically, consider each Template Haskell splice to be a roadblock:
functions before it cannot reference functions after it. In the case
of Yesod, I would recommend you look at how the default scaffolded
site is structured. In particular, instead of using mkYesod, it uses a
combination of mkYesodData and mkYesodDispatch to try and work around
some of these issues.
Michael
On Tue, May 10, 2011 at 1:20 AM, Patrick Palka
Hey,
I've attached a file that fails to compile, resulting in a "not in scope: getHomeR" error message. The culprit seems to be the mkPersist TH splice, which, when ocurring before the getHomeR view, causes it to not be seen by GHC when it parses the mkYesod splice. Moving the mkPersist splice to occur after the getHomeR view will alleviate this problem, but then one can't use the data constructors that mkPersist generates within the getHomeR view. Moving the mkPersist splice into a seperate module and importing that works perfectly fine, however.
Can anyone clarify what is going on? _______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
participants (2)
-
Michael Snoyman
-
Patrick Palka