From 53c633b53e8825cb9058fb88e86d1ca7828b83e6 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Thu, 27 Dec 2012 15:34:11 -0500 Subject: Add some name-mangling rules to allow XML attribute 'name' and attributes with dashes --- lib/ur/list.ur | 12 ++++++++++++ lib/ur/list.urs | 3 +++ 2 files changed, 15 insertions(+) (limited to 'lib') diff --git a/lib/ur/list.ur b/lib/ur/list.ur index bce5335e..cbb4faf2 100644 --- a/lib/ur/list.ur +++ b/lib/ur/list.ur @@ -437,3 +437,15 @@ fun mapXiM [m ::: Type -> Type] (_ : monad m) [a] [ctx ::: {Unit}] (f : int -> a in mapXiM' 0 end + +fun tabulateM [m] (_ : monad m) [a] (f : int -> m a) n = + let + fun tabulate' n acc = + if n <= 0 then + return acc + else + (v <- f (n-1); + tabulate' (n-1) (v :: acc)) + in + tabulate' n [] + end diff --git a/lib/ur/list.urs b/lib/ur/list.urs index b26c9ad9..66007a39 100644 --- a/lib/ur/list.urs +++ b/lib/ur/list.urs @@ -63,6 +63,9 @@ val all : a ::: Type -> (a -> bool) -> t a -> bool val app : m ::: (Type -> Type) -> monad m -> a ::: Type -> (a -> m unit) -> t a -> m unit +val tabulateM : m ::: (Type -> Type) -> monad m -> a ::: Type + -> (int -> m a) -> int -> m (t a) + val mapQuery : tables ::: {{Type}} -> exps ::: {Type} -> t ::: Type -> [tables ~ exps] => sql_query [] [] tables exps -- cgit v1.2.3