summaryrefslogtreecommitdiff
path: root/lib/ur/top.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-10-06 15:39:27 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-10-06 15:39:27 -0400
commit5765efc372a628ede62d8b27c799708f530a3456 (patch)
treefa80b1891097e60c758ecb12fd8c441f37a03c85 /lib/ur/top.ur
parent37f1efc23e011927873cfc5871ac7686eac5a745 (diff)
SELECT DISTINCT; eta expansion during Cjrization
Diffstat (limited to 'lib/ur/top.ur')
-rw-r--r--lib/ur/top.ur6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/ur/top.ur b/lib/ur/top.ur
index 67e75573..a2395d4f 100644
--- a/lib/ur/top.ur
+++ b/lib/ur/top.ur
@@ -92,6 +92,12 @@ fun read_option [t ::: Type] (_ : read t) =
fun txt [t] [ctx ::: {Unit}] [use ::: {Type}] (_ : show t) (v : t) =
cdata (show v)
+fun map0 [K] [tf :: K -> Type] (f : t :: K -> tf t) [r :: {K}] (fl : folder r) =
+ fl [fn r :: {K} => $(map tf r)]
+ (fn [nm :: Name] [t :: K] [rest :: {K}] [[nm] ~ rest] acc =>
+ acc ++ {nm = f [t]})
+ {}
+
fun mp [K] [tf1 :: K -> Type] [tf2 :: K -> Type] (f : t ::: K -> tf1 t -> tf2 t) [r :: {K}] (fl : folder r) =
fl [fn r :: {K} => $(map tf1 r) -> $(map tf2 r)]
(fn [nm :: Name] [t :: K] [rest :: {K}] [[nm] ~ rest] acc r =>