summaryrefslogtreecommitdiff
path: root/lib/ur/top.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-02-22 17:39:55 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-02-22 17:39:55 -0500
commitbb4aed8e1304d5cb3cbe7ec5fdcf95344e9aa2d5 (patch)
treea2766814d1fec880c763910917d1e4771455320a /lib/ur/top.ur
parent093d8971815cc1efbc56536454244d103e60e54c (diff)
demo/sum working with manual folders
Diffstat (limited to 'lib/ur/top.ur')
-rw-r--r--lib/ur/top.ur13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/ur/top.ur b/lib/ur/top.ur
index 9016fd27..5d2ae606 100644
--- a/lib/ur/top.ur
+++ b/lib/ur/top.ur
@@ -6,6 +6,19 @@ con folder = K ==> fn r :: {K} =>
-> 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