summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ur/listPair.ur10
-rw-r--r--lib/ur/listPair.urs2
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/ur/listPair.ur b/lib/ur/listPair.ur
new file mode 100644
index 00000000..9a56f75a
--- /dev/null
+++ b/lib/ur/listPair.ur
@@ -0,0 +1,10 @@
+fun mapX (a ::: Type) (b ::: Type) (ctx ::: {Unit}) f =
+ let
+ fun mapX' ls1 ls2 =
+ case (ls1, ls2) of
+ ([], []) => <xml/>
+ | (x1 :: ls1, x2 :: ls2) => <xml>{f x1 x2}{mapX' ls1 ls2}</xml>
+ | _ => error <xml>ListPair.mapX: Unequal list lengths</xml>
+ in
+ mapX'
+ end
diff --git a/lib/ur/listPair.urs b/lib/ur/listPair.urs
new file mode 100644
index 00000000..55a34b3a
--- /dev/null
+++ b/lib/ur/listPair.urs
@@ -0,0 +1,2 @@
+val mapX : a ::: Type -> b ::: Type -> ctx ::: {Unit}
+ -> (a -> b -> xml ctx [] []) -> list a -> list b -> xml ctx [] []