[web-devel] Template Haskell intricacies with mkPersist

Patrick Palka patrick at parcs.ath.cx
Tue May 10 00:20:49 CEST 2011


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?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestCase.hs
Type: text/x-haskell
Size: 517 bytes
URL: <http://www.haskell.org/pipermail/web-devel/attachments/20110509/59c77087/attachment.hs>

More information about the web-devel mailing list