aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/ur/list.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-05-21 11:45:04 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-05-21 11:45:04 -0400
commit32f6bd8f1bcf65a5db96160d63ef2050c9eb5e52 (patch)
tree502ef8ac60b6ab054bea740f53ef75ae77f0c66e /lib/ur/list.ur
parentc53470daa7b350ac8545d8934cedbcb1aae49bd0 (diff)
Change List.mapM' to avoid leaving functions around
Diffstat (limited to 'lib/ur/list.ur')
-rw-r--r--lib/ur/list.ur6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/ur/list.ur b/lib/ur/list.ur
index 2ee60538..7079f6bc 100644
--- a/lib/ur/list.ur
+++ b/lib/ur/list.ur
@@ -44,8 +44,8 @@ fun mapM (m ::: (Type -> Type)) (_ : monad m) (a ::: Type) (b ::: Type) f =
let
fun mapM' acc ls =
case ls of
- [] => acc
- | x :: ls => mapM' (x' <- f x; ls' <- acc; return (x' :: ls')) ls
+ [] => return (rev acc)
+ | x :: ls => x' <- f x; mapM' (x' :: acc) ls
in
- mapM' (return [])
+ mapM' []
end