我在略微改变的Yesod脚手架上遇到了麻烦。我在/ config / models中描述了我的实体:
Artist
ident Int
value Text
这是我在/Handler/Artist.hs的处理程序
{-# LANGUAGE QuasiQuotes, TypeFamilies, GeneralizedNewtypeDeriving, TemplateHaskell,
OverloadedStrings, GADTs, FlexibleContexts #-}
module Handler.Artist where
import Import
import qualified Control.Monad.IO.Class as M
import Text.Hamlet (shamlet)
import Text.Blaze.Html.Renderer.String (renderHtml)
import Database.Persist
import Database.Persist.Sqlite
import Database.Persist.TH
import Control.Monad.IO.Class (liftIO)
getArtistR = concatMap (renderListElement . value) $ artists
where artists = selectList ([] :: [Filter Artist]) []
renderListElement name = renderHtml [shamlet|<li>#{name}|]
(我包括冗余:))
最后,我的错误:
Rebuilding application... (using cabal)
Handler/Artist.hs:14:45: Not in scope: `value'
Build failure, pausing...
我不知道该怎么做!我是否需要在处理程序中输入$(widgetFile "artist")
之类的内容?补丁哪里出错了?任何帮助都会非常棒。提前谢谢!!!