aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/ur/top.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-02-24 13:50:39 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-02-24 13:50:39 -0500
commit330dbb60d0cffe60d5257adbd82028737165bf63 (patch)
tree84b91f76ce37f9fb6245d9040c9641188968f729 /lib/ur/top.ur
parent541bd325e7e0be52aa27dd56f16f489c44e05d2b (diff)
Top.Fold.mp
Diffstat (limited to 'lib/ur/top.ur')
-rw-r--r--lib/ur/top.ur11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/ur/top.ur b/lib/ur/top.ur
index 0fca0a5b..5ce6ea9a 100644
--- a/lib/ur/top.ur
+++ b/lib/ur/top.ur
@@ -29,6 +29,17 @@ structure Folder = struct
[[nm] ~ r1'] [[nm = v] ++ r1' ~ r2] =>
f [nm] [v] [r1' ++ r2] acc !)
(fn [[] ~ r2] => f2 [tf] f i) !
+
+ fun mp K1 K2 (f ::: K1 -> K2) (r ::: {K1})
+ (fold : folder r)
+ (tf :: {K2} -> Type)
+ (f : nm :: Name -> v :: K2 -> r :: {K2} -> tf r
+ -> [[nm] ~ r] => tf ([nm = v] ++ r))
+ (i : tf []) =
+ fold [fn r => tf (map f r)]
+ (fn (nm :: Name) (v :: K1) (rest :: {K1}) (acc : tf (map f rest)) [[nm] ~ rest] =>
+ f [nm] [f v] [map f rest] acc !)
+ i
end