Scaffolding has nicer Form datatype

This commit is contained in:
Michael Snoyman 2011-11-10 02:25:40 +02:00
parent 6b685289fd
commit e4fd390cf8
4 changed files with 9 additions and 3 deletions

View File

@ -11,6 +11,7 @@ module Yesod.Form.Types
, Ints (..) , Ints (..)
-- * Form -- * Form
, Form , Form
, MForm
, AForm (..) , AForm (..)
-- * Build forms -- * Build forms
, Field (..) , Field (..)
@ -75,6 +76,8 @@ type FileEnv = Map.Map Text FileInfo
type Lang = Text type Lang = Text
type Form sub master a = RWST (Maybe (Env, FileEnv), master, [Lang]) Enctype Ints (GGHandler sub master IO) a type Form sub master a = RWST (Maybe (Env, FileEnv), master, [Lang]) Enctype Ints (GGHandler sub master IO) a
{-# DEPRECATE Form "Use MForm instead" #-}
type MForm sub master a = RWST (Maybe (Env, FileEnv), master, [Lang]) Enctype Ints (GGHandler sub master IO) a
newtype AForm sub master a = AForm newtype AForm sub master a = AForm
{ unAForm :: (master, [Text]) -> Maybe (Env, FileEnv) -> Ints -> GGHandler sub master IO (FormResult a, [FieldView sub master] -> [FieldView sub master], Ints, Enctype) { unAForm :: (master, [Text]) -> Maybe (Env, FileEnv) -> Ints -> GGHandler sub master IO (FormResult a, [FieldView sub master] -> [FieldView sub master], Ints, Enctype)

View File

@ -1,5 +1,5 @@
name: yesod-form name: yesod-form
version: 0.3.3 version: 0.3.4
license: BSD3 license: BSD3
license-file: LICENSE license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com> author: Michael Snoyman <michael@snoyman.com>

View File

@ -5,6 +5,7 @@ module Foundation
, resources~sitearg~ , resources~sitearg~
, Handler , Handler
, Widget , Widget
, Form
, maybeAuth , maybeAuth
, requireAuth , requireAuth
, module Yesod , module Yesod
@ -15,7 +16,7 @@ module Foundation
) where ) where
import Prelude import Prelude
import Yesod import Yesod hiding (Form)
import Yesod.Static (Static, base64md5, StaticRoute(..)) import Yesod.Static (Static, base64md5, StaticRoute(..))
import Settings.StaticFiles import Settings.StaticFiles
import Yesod.Auth import Yesod.Auth
@ -73,6 +74,8 @@ mkMessage "~sitearg~" "messages" "en"
-- split these actions into two functions and place them in separate files. -- split these actions into two functions and place them in separate files.
mkYesodData "~sitearg~" $(parseRoutesFile "config/routes") mkYesodData "~sitearg~" $(parseRoutesFile "config/routes")
type Form x = Html -> MForm ~sitearg~ ~sitearg~ (FormResult x, Widget)
-- Please see the documentation for the Yesod typeclass. There are a number -- Please see the documentation for the Yesod typeclass. There are a number
-- of settings which can be configured by overriding methods here. -- of settings which can be configured by overriding methods here.
instance Yesod ~sitearg~ where instance Yesod ~sitearg~ where

View File

@ -76,7 +76,7 @@ executable ~project~
, yesod-auth >= 0.7.3 && < 0.8 , yesod-auth >= 0.7.3 && < 0.8
, yesod-static >= 0.3.1 && < 0.4 , yesod-static >= 0.3.1 && < 0.4
, yesod-default >= 0.4 && < 0.5 , yesod-default >= 0.4 && < 0.5
, yesod-form >= 0.3.3 && < 0.4 , yesod-form >= 0.3.4 && < 0.4
, mime-mail >= 0.3.0.3 && < 0.4 , mime-mail >= 0.3.0.3 && < 0.4
, clientsession >= 0.7.3 && < 0.8 , clientsession >= 0.7.3 && < 0.8
, bytestring >= 0.9 && < 0.10 , bytestring >= 0.9 && < 0.10