Yesod:函数 isAuthorized 中的非详尽模式

Yesod: Non-exhaustive patterns in function isAuthorized

在 Yesod 脚手架项目中,我添加了一个新路由和一个新处理程序。

我的错误如下:

29/Mar/2017:11:25:22 +0200 [Error#yesod-core] Foundation.hs:(137,5)-(144,45): Non-exhaustive patterns in function isAuthorized
 @(yesod-core-1.4.32-6HthMZNCl0sEMRz6GJ4QO1:Yesod.Core.Class.Yesod ./Yesod/Core/Class/Yesod.hs:693:5)
29/Mar/2017:11:25:22 +0200 [Debug#SQL] SELECT `ident`,`password` FROM `user` WHERE `id`=? ; [PersistInt64 1]

我该如何解决?

需要修改Foundation.hs文件,添加新的授权路径:

-- Routes not requiring authentication.
isAuthorized (AuthR _) _ = return Authorized
isAuthorized CommentR _ = return Authorized
isAuthorized HomeR _ = return Authorized
isAuthorized FaviconR _ = return Authorized
isAuthorized RobotsR _ = return Authorized
isAuthorized (StaticR _) _ = return Authorized
isAuthorized TestR _ = return Authorized

isAuthorized ProfileR _ = isAuthenticated