Advertisement
mithrandi

Untitled

Feb 7th, 2012
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. shopProds :: V.Vector Int -> [Prod]
  2.           -> View Html IO  (Either Int Prod)
  3. shopProds cart products=
  4.   br
  5.   <++                    -- add Html to the first widget
  6.   p << "-----Shopping List-----"
  7.   <++
  8.   widget(Selection{
  9.        stitle = bold << "choose an item",
  10.        sheader= [ bold << "item"   , bold << "price", bold << "times chosen"],
  11.        sbody= [([toHtml pname, toHtml $ show pprice, toHtml $ show $ cart V.! i],i )
  12.               | (Prod{..},i ) <- zip products [1..]]})
  13.  
  14.   <+>                    -- operator to mix two wdigets
  15.  
  16.   br
  17.   <++                    -- add Html to the second widget
  18.   p << "---Add a new product---"
  19.   <++
  20.   table <<<              -- <<< encloses a widget in HTML tags
  21.             (tr <<< td ! [valign "top"]
  22.                           <<< widget (Form (Nothing :: Maybe Prod) )
  23.  
  24.              ++>         -- append Html after the widget
  25.  
  26.              tr << td ! [align "center"]
  27.                           << hotlink  "hello"
  28.                                       (bold << "Hello World"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement