相关疑难解决方法(0)

这个 YesodAuth 实例有什么问题?

我刚刚从当前的 yesod 脚手架迁移到了最新的yesod-1.6.0, yesod-auth-1.6.2.

instance YesodAuth App where
    type AuthId App = UserId

    -- ....

    authenticate creds = runDB $ do
        x <- getBy $ UniqueUser $ credsIdent creds
        case x of
            Just (Entity uid _) -> return $ Authenticated uid
            Nothing -> return $ UserError InvalidUsernamePass
Run Code Online (Sandbox Code Playgroud)

在迁移之前,此代码运行良好。但是之后出现以下错误。

.../src/Foundation.hs:212:26: error:
    • Could not deduce: m ~ HandlerFor site8
      from the context: (MonadHandler m, HandlerSite m ~ App)
        bound by the type signature for:
                   authenticate :: forall (m …
Run Code Online (Sandbox Code Playgroud)

haskell yesod

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

标签 统计

haskell ×1

yesod ×1