Formlets ever had cascade validation:

data Item= Item{ name ::String, quantity, price :: Int}

Item <$>
       <*> inputString `validate` nonEmpty
       <*> inputInt
       <*> inputInt 
 `validate` ( \item -> do
      if theUniverseIsSpanding then do
           if name item == "carrots" && price=="10" then
                       fail "we don´t like 10 cent carrots  in an expanding universe"
           else if.....


2014-08-14 11:41 GMT+02:00 Tom Ellis <tom-lists-haskell-cafe-2013@jaguarpaw.co.uk>:
On Thu, Aug 14, 2014 at 11:28:53AM +0200, Wojtek Narczyński wrote:
> On 14.08.2014 09:19, Tom Ellis wrote:
> >On Wed, Aug 13, 2014 at 05:21:28PM -0700, John Lato wrote:
> >>On Wed, Aug 13, 2014 at 4:21 PM, Tom Ellis
> >>>     data LineItem = LineItem { name :: Maybe String
> >>>                              , quantity :: Maybe Quantity
> >>>                              , price :: Maybe Price }
> >>Rather than this definition, what about something like:
> >>
> >>     data LineItemF f = LineItem
> >>         { name :: f String
> >>         , quantity :: f Quantity
> >>         , price :: f Price }
> >It seems Wojtek already objected to this approach, though perhaps that
> >objection could be overcome
>
> Hmm, perhaps like this
>
> LineItemFi = LineItemFi
>    { name :: StringFi
>    , quantity :: QuantityFi
>    , price :: PriceFi }
>
>
> data LineItemUi f = LineItemUi
>     { name :: StringUi
>     , quantity :: QuantityUi
>     , price :: PriceUi }

You didn't use f there.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe



--
Alberto.