comparison demo/more/meta.ur @ 1007:d3af9e54c828

Title and abstract
author Adam Chlipala <adamc@hcoop.net>
date Thu, 22 Oct 2009 11:37:58 -0400
parents a87495bcaeec
children 1911e84df461
comparison
equal deleted inserted replaced
1006:5a0f6ec208ce 1007:d3af9e54c828
23 Widget = fn [nm :: Name] => <xml><checkbox{nm}/></xml>, 23 Widget = fn [nm :: Name] => <xml><checkbox{nm}/></xml>,
24 WidgetPopulated = fn [nm :: Name] b => 24 WidgetPopulated = fn [nm :: Name] b =>
25 <xml><checkbox{nm} checked={b}/></xml>, 25 <xml><checkbox{nm} checked={b}/></xml>,
26 Parse = fn x => x, 26 Parse = fn x => x,
27 Inject = _} 27 Inject = _}
28
29 fun textarea name = {Nam = name,
30 Show = cdata,
31 Widget = fn [nm :: Name] => <xml><br/><textarea{nm} rows={10} cols={80}/></xml>,
32 WidgetPopulated = fn [nm :: Name] s => <xml><br/>
33 <textarea{nm} rows={10} cols={80}>{[s]}</textarea>
34 </xml>,
35 Parse = fn s => s,
36 Inject = _}
37
38 fun allWidgets [ts ::: {(Type * Type)}] (r : $(map meta ts)) (fl : folder ts) =
39 foldR [meta] [fn ts :: {(Type * Type)} => xml form [] (map snd ts)]
40 (fn [nm :: Name] [t :: (Type * Type)] [rest :: {(Type * Type)}]
41 [[nm] ~ rest] (col : meta t) (acc : xml form [] (map snd rest)) => <xml>
42 <b>{[col.Nam]}</b>: {col.Widget [nm]}<br/>
43 {useMore acc}
44 </xml>)
45 <xml/>
46 [_] fl r