aboutsummaryrefslogtreecommitdiffhomepage
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
parent2b3788462fada38dab4a72d036aff5e66b8d9240 (diff)
List.all; fix ANDALSO/ORELSE parsing precedence
-rw-r--r--lib/ur/list.ur10
-rw-r--r--lib/ur/list.urs2
-rw-r--r--src/urweb.grm2
3 files changed, 13 insertions, 1 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
diff --git a/src/urweb.grm b/src/urweb.grm
index 5a2da601..b954ba8c 100644
--- a/src/urweb.grm
+++ b/src/urweb.grm
@@ -365,9 +365,9 @@ fun patType loc (p : pat) =
%right SEMI
%nonassoc LARROW
%nonassoc IF THEN ELSE
+%nonassoc DARROW
%left ANDALSO
%left ORELSE
-%nonassoc DARROW
%nonassoc COLON
%nonassoc DCOLON TCOLON
%left UNION INTERSECT EXCEPT