haskell - Yesod generateFormPost - No instance for (RenderMessage master0 FormMessage) -
i tried follow screencast michael snoyman http://vimeo.com/39646807. however, seems changes i18n causes code fail. can't find information on how solve problem on scaffolded site , can't quite make sense of information given here http://www.yesodweb.com/book/internationalization.
this error get, referring code in home.hs:
no instance (rendermessage master0 formmessage) arising use of `generateformpost' possible fix: add instance declaration (rendermessage master0 formmessage) in stmt of 'do' block: (formwidget, enctype) <- generateformpost noteform in expression: { (formwidget, enctype) <- generateformpost noteform; defaultlayout ($(widgetfile "notes")) } in equation `getnotesr': getnotesr = { (formwidget, enctype) <- generateformpost noteform; defaultlayout ($(widgetfile "notes")) }
the information seems pretty clear, problem can't figure out how add instance declaration (rendermessage master0 formmessage).
here's code added home.hs
noteform = renderbootstrap $ note <$> areq textfield "title" nothing <*> areq textfield "content" nothing getnotesr = (formwidget, enctype) <- generateformpost noteform defaultlayout $(widgetfile "notes") postnotesr = return () getnoter noteid = return ()
ant following templates/notes.hamlet
<form method=post enctype=#{enctype}> ^{formwidget} <input type=submit>
as general proposition, when see this:
no instance (rendermessage master0 formmessage)
bear in mind master0
(or starting lowercase letter) free type variable has not been instantiated concrete type. can mentally replace a
if helps. see message says there's no generic rendermessage
instance uniquely determined formmessage
in second parameter , arbitrary type in first parameter.
therefore, usual way fix figure out want instantiate free type to, , provide type signature or other hint fix instantiation.
in case, type signature suggested michael snoyman noteform :: form note
serves purpose.
Comments
Post a Comment