Is it possible to have sitewide variables in Yesod? Suppose I have a main menu, which records are collected from the database and which are displayed on each page: do I need to manually extract records in each handler?
I tried to do this in Foundation.hs in the instance Yesod App defaultLayout in defaultLayout :
instance Yesod App where ... defaultLayout widget = do ... entries <- runDB $ selectList [RubricOnTop ==. True] [] ...
But this does not compile: I have an Entity type mismatch with RubricGeneric .
Decision
$forall rubric <- map entityVal rubrics ...
in default-layout-wrapper.hamlet. Could not find a solution for this in the defaultLayout function.
zw0rk source share