小编ren*_*nny的帖子

Yesod:在ghci中运行`runDB`函数时输入实例错误

在ghci中加载scaffolded站点后获取runDB的正确实例是什么?例如,在运行这句话时:

runDB $ selectList [UserName ==. "Renny"] []
Run Code Online (Sandbox Code Playgroud)

错误是:

Couldn't match type `PersistMonadBackend
(YesodPersistBackend site0 (HandlerT site0 IO))'
with `persistent-1.3.0.6:Database.Persist.Sql.Types.SqlBackend'
The type variable `site0' is ambiguous
Possible fix: add a type signature that fixes these type variable(s)
Expected type: PersistMonadBackend
                 (YesodPersistBackend site0 (HandlerT site0 IO))
  Actual type: PersistEntityBackend User
In the second argument of `($)', namely
  `selectList [UserName ==. "Renny"] []'
In the expression: runDB $ selectList [UserName ==. "Renny"] []
In an equation for `it':
    it = runDB $ …
Run Code Online (Sandbox Code Playgroud)

haskell persistent ghci yesod

5
推荐指数
1
解决办法
449
查看次数

标签 统计

ghci ×1

haskell ×1

persistent ×1

yesod ×1