From 41cd154483d45c5d2fb0abf392b9bdc63d42b94e Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Wed, 25 Jan 2017 15:55:14 -0500 Subject: List.appi --- lib/ur/list.ur | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/ur/list.ur') diff --git a/lib/ur/list.ur b/lib/ur/list.ur index 50764e46..cc533676 100644 --- a/lib/ur/list.ur +++ b/lib/ur/list.ur @@ -311,6 +311,18 @@ fun app [m] (_ : monad m) [a] f = app' end +fun appi [m] (_ : monad m) [a] f = + let + fun app' i ls = + case ls of + [] => return () + | x :: ls => + f i x; + app' (i + 1) ls + in + app' 0 + end + fun mapQuery [tables ::: {{Type}}] [exps ::: {Type}] [t ::: Type] [tables ~ exps] (q : sql_query [] [] tables exps) (f : $(exps ++ map (fn fields :: {Type} => $fields) tables) -> t) = -- cgit v1.2.3