1

次の構成レコードのフォームを作成しようとしています:

data Configuration = Configuration
   { cMail        :: Mail
   , cIdentity    :: Identity
   , cAttachments :: [(Text, FilePath)]
   } deriving Eq

data Mail = Mail
   { mFullMail :: Text
   , mServer   :: Text
   , mPort     :: Text
   , mUser     :: Text
   , mPassword :: Text
   } deriving (Eq, Show)

data Identity = Identity
   { iName        :: Text
   , iLastName    :: Text
   , iHonorific   :: Maybe Text
   , iBirthday    :: Maybe Text
   , iOrigin      :: Maybe Text
   , iNationality :: Maybe Text
   , iAddress     :: Maybe Text
   , iTown        :: Maybe Text
   , iCp          :: Maybe Text
   , iCountry     :: Maybe Text
   , iPhone       :: Maybe Text
   , iMobile      :: Maybe Text
   } deriving (Eq, Show)

私はまだテストしていない次のことを考え出しました:

configureForm :: Form Configuration
configureForm = renderDivs $ Configuration
                -- I don't know if the following is right
                <$> $ Mail <$> areq textField "fullmail :" Nothing
                           <*> areq textField "server : " Nothing
                            -- etc..
                <*> $ Identity <$> areq textField "name : " Nothing
                               <*> areq textField "lastname : " Nothing
                               <*> aopt textField "honorific : " Nothing
                               -- etc..
                <*> -- the part I can't figure out

しかし、最後の部分で立ち往生しているため、テストできません。フォームの記入方法に関するヒントはありますか?

4

0 に答える 0