我刚刚从当前的 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)