我在耶索德应用程序试图消除持久性。 我的模型文件包含
Job
issuer MemberId
addDate UTCTime
lastDate UTCTime
title Text
description Text
deriving Show Read
而我的处理程序:
getProfileR :: Handler RepHtml
getProfileR = do
jobs <- runDB $ selectList [] [Desc JobAddDate]
defaultLayout $ do
setTitle "title"
$(widgetFile "profile")
在profile.hamlet我环槽的对象
$forall Job issuer addDate lastDate title description <- jobs
<p>#{issuer}
不过,我得到以下错误
Handler/Profile.hs:36:18:
Couldn't match type `Entity' with `JobGeneric'
In the return type of a call of `selectList'
In the second argument of `($)', namely
`selectList [] [Desc JobAddDate]'
In a stmt of a 'do' block:
jobs <- runDB $ selectList [] [Desc JobAddDate]
Handler/Profile.hs:36:18:
Kind incompatibility when matching types:
t0 :: (* -> *) -> * -> *
JobGeneric Database.Persist.GenericSql.Raw.SqlPersist :: *
In the return type of a call of `selectList'
In the second argument of `($)', namely
`selectList [] [Desc JobAddDate]'
In a stmt of a 'do' block:
jobs <- runDB $ selectList [] [Desc JobAddDate]
Build failure, pausing...
其中第36行是runDB线。
作为新的哈斯克尔,我无法弄清楚什么是错。 我下面的耶索德书。 他们是不幸的是避免了脚手架网站,所以我不能完全模仿他们的代码。