You'd really need to define a special datatype to represent that, such as:
data Contact = JustTelephone Telephone | JustAddress Address |
Both Telephone Address
Then you could write some kind of a function to combine them:
makeContact :: FormResult (Maybe Telephone) -> FormResult (Maybe
Address) -> FormResult Contact
makeContact fmt fma =
go $ (,) <$> fmt <*> fma
where
go (FormSuccess (mt, ma)) =
case (mt, ma) of
(Nothing, Nothing) -> FormFailure ["You must provide
either a telephone number or mailing address."]
(Just t, Just a) -> FormSuccess $ Both t a
...
go (FormFailure es) = FormFailure es
go FormMissing = FormMissing
Michael