diff lib/ur/top.ur @ 627:f4f2b09a533a

demo/sum working with manual folders
author Adam Chlipala <adamc@hcoop.net>
date Sun, 22 Feb 2009 17:39:55 -0500
parents 588b9d16b00a
children 12b73f3c108e
line wrap: on
line diff
--- a/lib/ur/top.ur	Sun Feb 22 17:17:01 2009 -0500
+++ b/lib/ur/top.ur	Sun Feb 22 17:39:55 2009 -0500
@@ -6,6 +6,19 @@
                           -> fn [[nm] ~ r] => tf ([nm = v] ++ r))
                       -> tf [] -> tf r
 
+structure Folder = struct
+    fun nil K (tf :: {K} -> Type)
+            (f : nm :: Name -> v :: K -> r :: {K} -> tf r
+                 -> fn [[nm] ~ r] => tf ([nm = v] ++ r))
+            (i : tf []) = i
+
+    fun cons K (r ::: {K}) (nm :: Name) (v :: K) [[nm] ~ r] (fold : folder r)
+             (tf :: {K} -> Type)
+             (f : nm :: Name -> v :: K -> r :: {K} -> tf r
+                  -> fn [[nm] ~ r] => tf ([nm = v] ++ r))
+             (i : tf []) = f [nm] [v] [r] (fold [tf] f i)
+end
+
 
 fun not b = if b then False else True