0
我正在嘗試編寫自定義Yesod註冊表單。我遇到的問題是,當它到達fvInput它似乎是使用應用程序,而不是身份驗證。我不太確定這應該如何處理,我似乎無法找到它的術語。我嘗試過在表單中以各種方式解除,我只能讓它拋出不同的錯誤。此外,這個錯誤被拋出的唯一時間是如果我有fvInput行,但如果我刪除沒有錯誤被拋出,它編譯正確。Yesod fvInput無法與'Auth'匹配'App'
代碼:
registrationForm :: Html -> MForm (HandlerT Auth (HandlerT App IO)) (FormResult UserForm, Widget)
registrationForm extra = do
(emailRes, emailView) <- mreq textField "" Nothing
let userRes = UserForm <$> emailRes
let widget = do
[whamlet|
#{extra}
^{fvInput emailView}
<input type=Submit value="Registration">
|]
return (userRes, widget)
錯誤:
Foundation.hs:169:30:
Couldn't match type ‘App’ with ‘Auth’
In the second argument of ‘(GHC.Base..)’, namely ‘toWidget’
In the expression: asWidgetT GHC.Base.. toWidget
In a stmt of a 'do' block:
(asWidgetT GHC.Base.. toWidget) (fvInput emailView)
預先感謝您的幫助!
- 編輯
錯誤與MREQ之前電梯:
Foundation.hs:166:49:
Couldn't match type ‘HandlerT Auth (HandlerT App IO)’
with ‘transformers-0.4.2.0:Control.Monad.Trans.RWS.Lazy.RWST
(Maybe (Env, FileEnv), HandlerSite m0, [Lang]) Enctype Ints m0’
Expected type: HandlerT
Auth (HandlerT App IO) (FormResult Text, FieldView App)
Actual type: MForm m0 (FormResult Text, FieldView App)
In the second argument of ‘($)’, namely ‘mreq textField "" Nothing’
In a stmt of a 'do' block:
(emailRes, emailView) <- lift $ mreq textField "" Nothing
我曾嘗試過在某一點。我認爲這是錯誤的,因爲它正在拋出另一個錯誤。我會更新上面的帖子,讓其他錯誤加上電梯。謝謝你的幫助! – Lethjakman
我的錯誤,電梯是錯誤的。我會更新答案。 –
就是這樣。謝謝! – Lethjakman