Mercurial > urweb
diff demo/tcSum.ur @ 417:e0e9e9eca1cb
Fix nasty de Bruijn substitution bug; TcSum demo
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 23 Oct 2008 12:58:35 -0400 |
parents | |
children | 6c4643880df5 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/demo/tcSum.ur Thu Oct 23 12:58:35 2008 -0400 @@ -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>