我正在尝试为以下配置记录制作表格:
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
但是我坚持最后一部分,所以无法测试。有关如何填写表格的任何提示?