我正在尝试在 Yesod 中通过 id 获取记录。我的代码是:
getEditActorR :: Handler Html
getEditActorR = do
actorId <- runInputGet $ ireq intField "id"
actor <- runDB $ get $ Key $ PersistInt64 (fromIntegral actorId)
defaultLayout $ do
$(widgetFile "actor-edit")
我得到的错误是:
• Couldn't match type ‘PersistEntityBackend record0’
with ‘SqlBackend’
arising from a use of ‘get’
The type variable ‘record0’ is ambiguous
• In the second argument of ‘($)’, namely
‘get $ Key $ PersistInt64 (fromIntegral actorId)’
In a stmt of a 'do' block:
actor <- runDB $ get $ Key $ PersistInt64 (fromIntegral actorId)
In the expression:
do { actorId <- runInputGet $ ireq intField "id";
actor <- runDB $ get $ Key $ PersistInt64 (fromIntegral actorId);
defaultLayout $ do { (do { ... }) } }
我该如何解决?