1
votes

I did a fresh install of yesod (cabal install yesod) and tried the form-example on page http://www.yesodweb.com/book/forms where the custom field is used. Compiler gives errors on data constructor and functions not in scope.

See http://hpaste.org/49690 for code and error-list. How is this solved?

When running from scaffolded project, I get the same errors...

1
What version of yesod-form do you have installed? Is the error message any different if you add a import Yesod.Form line? - Michael Snoyman
No differences when adding Yesod.Form. Installed version is 0.1.0.1. Cabal output: Default available version: 0.2.0.1 Installed versions: 0.1.0.1 - davidbe

1 Answers

4
votes

These appears to be errors in the example, caused by missing import statements.

You'll need to import these modules:

  • Control.Monad for mplus.
  • Data.Maybe for fromMaybe.
  • Safe for readMay (from the safe package).
  • Yesod.Form.Core for newFormIdent, askParams and the GForm constructor.

Having fixed that, another error appears:

FormSuccess (Params min max single plural)

should be

FormSuccess (Params (min, max) single plural)

I got it to run with these changes on Yesod 0.8.2.1 (with yesod-form-0.1.0.1)