changeset 843:9f0ea203a1ca

List.all; fix ANDALSO/ORELSE parsing precedence
author Adam Chlipala <adamc@hcoop.net>
date Sun, 07 Jun 2009 14:15:22 -0400
parents d1b6acaec265
children 74a1e3bdf430
files lib/ur/list.ur lib/ur/list.urs src/urweb.grm
diffstat 3 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lib/ur/list.ur	Sun Jun 07 12:01:55 2009 -0400
+++ b/lib/ur/list.ur	Sun Jun 07 14:15:22 2009 -0400
@@ -161,3 +161,13 @@
     in
         foldlM'
     end
+
+fun all [m] f =
+    let
+        fun all' ls =
+            case ls of
+                [] => True
+              | x :: ls => f x && all' ls
+    in
+        all'
+    end
--- a/lib/ur/list.urs	Sun Jun 07 12:01:55 2009 -0400
+++ b/lib/ur/list.urs	Sun Jun 07 14:15:22 2009 -0400
@@ -33,3 +33,5 @@
 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
--- a/src/urweb.grm	Sun Jun 07 12:01:55 2009 -0400
+++ b/src/urweb.grm	Sun Jun 07 14:15:22 2009 -0400
@@ -365,9 +365,9 @@
 %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