Yesod 数据库持久记录访问

Yesod database persistent record access

下面是 models 文件

UserSetting
    source ArticleSourceId
    minimumShouldMatch Int 
    articleLength Int
    userId UserId
    deriving Show

在我的处理程序中,我发现我无法在实体值 vVal 上使用例如 source

   (v:_) <- selectList [UserSettingUserId ==. asUd] [LimitTo 1]
   let vVal = source $ entityVal v
   let vId = entityKey v

错误信息是Variable not in scope: source :: UserSetting -> Integer

这会起作用:

let vVal = userSettingSource $ entityVal v