Fix issue with yesod-core > 1.4.13.

yesod-core-1.4.14 changed the Template Haskell behind the expansion of
mkYesodData, such that it now must have the application data type
declared before it is called.  This change simply moves the call to
mkYesodData to be after the data type it wants to access is declared.

https://github.com/yesodweb/yesod/issues/1059 has some discussion of the
issue from the Yesod side.
This commit is contained in:
Michael Alan Dorman 2015-08-23 12:33:25 -04:00
parent 4ba9bf853d
commit a6bea7f767

View file

@ -36,8 +36,6 @@ publicFiles "static"
staticRoutes :: Static staticRoutes :: Static
staticRoutes = $(embed "static") staticRoutes = $(embed "static")
mkYesodData "WebApp" $(parseRoutesFile "Assistant/WebApp/routes")
data WebApp = WebApp data WebApp = WebApp
{ assistantData :: AssistantData { assistantData :: AssistantData
, authToken :: AuthToken , authToken :: AuthToken
@ -49,6 +47,8 @@ data WebApp = WebApp
, listenHost ::Maybe HostName , listenHost ::Maybe HostName
} }
mkYesodData "WebApp" $(parseRoutesFile "Assistant/WebApp/routes")
instance Yesod WebApp where instance Yesod WebApp where
{- Require an auth token be set when accessing any (non-static) route -} {- Require an auth token be set when accessing any (non-static) route -}
isAuthorized _ _ = checkAuthToken authToken isAuthorized _ _ = checkAuthToken authToken