summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-06-07 14:15:22 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-06-07 14:15:22 -0400
commit07249bc2c07b2af3b9decb84ce968e3005a19c0f (patch)
tree15b41a16e734ff4738bf2b275546736121cf125a /lib
parent2b3788462fada38dab4a72d036aff5e66b8d9240 (diff)
List.all; fix ANDALSO/ORELSE parsing precedence
Diffstat (limited to 'lib')
-rw-r--r--lib/ur/list.ur10
-rw-r--r--lib/ur/list.urs2
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/ur/list.ur b/lib/ur/list.ur
index 89dc8bbd..771cddc3 100644
--- a/lib/ur/list.ur
+++ b/lib/ur/list.ur
@@ -161,3 +161,13 @@ fun foldlM [m] (_ : monad m) [a] [b] f =
in
foldlM'
end
+
+fun all [m] f =
+ let
+ fun all' ls =
+ case ls of
+ [] => True
+ | x :: ls => f x && all' ls
+ in
+ all'
+ end
diff --git a/lib/ur/list.urs b/lib/ur/list.urs
index 89e7eecb..6a653ba9 100644
--- a/lib/ur/list.urs
+++ b/lib/ur/list.urs
@@ -33,3 +33,5 @@ val foldlMap : a ::: Type -> b ::: Type -> c ::: Type
val assoc : a ::: Type -> b ::: Type -> eq a -> a -> t (a * b) -> option b
val search : a ::: Type -> b ::: Type -> (a -> option b) -> t a -> option b
+
+val all : a ::: Type -> (a -> bool) -> t a -> bool