summaryrefslogtreecommitdiff
path: root/demo/more/meta.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-10-22 11:37:58 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-10-22 11:37:58 -0400
commit7726688ab1c0bd5b73c4bb756fa6357b2212e44e (patch)
treed01adf8864ff4c51397dad698c541b0d3c38b0f2 /demo/more/meta.ur
parent78ec4fdf7ff7bf9e53732228aaa5928e4be519a9 (diff)
Title and abstract
Diffstat (limited to 'demo/more/meta.ur')
-rw-r--r--demo/more/meta.ur19
1 files changed, 19 insertions, 0 deletions
diff --git a/demo/more/meta.ur b/demo/more/meta.ur
index 2a8787f7..39aeb901 100644
--- a/demo/more/meta.ur
+++ b/demo/more/meta.ur
@@ -25,3 +25,22 @@ fun bool name = {Nam = name,
<xml><checkbox{nm} checked={b}/></xml>,
Parse = fn x => x,
Inject = _}
+
+fun textarea name = {Nam = name,
+ Show = cdata,
+ Widget = fn [nm :: Name] => <xml><br/><textarea{nm} rows={10} cols={80}/></xml>,
+ WidgetPopulated = fn [nm :: Name] s => <xml><br/>
+ <textarea{nm} rows={10} cols={80}>{[s]}</textarea>
+ </xml>,
+ Parse = fn s => s,
+ Inject = _}
+
+fun allWidgets [ts ::: {(Type * Type)}] (r : $(map meta ts)) (fl : folder ts) =
+ foldR [meta] [fn ts :: {(Type * Type)} => xml form [] (map snd ts)]
+ (fn [nm :: Name] [t :: (Type * Type)] [rest :: {(Type * Type)}]
+ [[nm] ~ rest] (col : meta t) (acc : xml form [] (map snd rest)) => <xml>
+ <b>{[col.Nam]}</b>: {col.Widget [nm]}<br/>
+ {useMore acc}
+ </xml>)
+ <xml/>
+ [_] fl r