summaryrefslogtreecommitdiff
path: root/demo/tcSum.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-10-23 12:58:35 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-10-23 12:58:35 -0400
commit0fa422bfaf3931aacff958cb73d44ebfa4191f4a (patch)
tree23055572341487865f0ef6cff685404f796a2410 /demo/tcSum.ur
parent833f4d2e0474ec3ff772107b52711289c4b648cf (diff)
Fix nasty de Bruijn substitution bug; TcSum demo
Diffstat (limited to 'demo/tcSum.ur')
-rw-r--r--demo/tcSum.ur9
1 files changed, 9 insertions, 0 deletions
diff --git a/demo/tcSum.ur b/demo/tcSum.ur
new file mode 100644
index 00000000..53679116
--- /dev/null
+++ b/demo/tcSum.ur
@@ -0,0 +1,9 @@
+fun sum (t ::: Type) (_ : num t) (fs ::: {Unit}) (x : $(mapUT t fs)) =
+ foldUR [t] [fn _ => t]
+ (fn (nm :: Name) (rest :: {Unit}) [[nm] ~ rest] n acc => n + acc)
+ zero [fs] x
+
+fun main () = return <xml><body>
+ {[sum {A = 0, B = 1}]}<br/>
+ {[sum {C = 2.1, D = 3.2, E = 4.3}]}
+</body></xml>