From 07249bc2c07b2af3b9decb84ce968e3005a19c0f Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sun, 7 Jun 2009 14:15:22 -0400 Subject: List.all; fix ANDALSO/ORELSE parsing precedence --- lib/ur/list.ur | 10 ++++++++++ lib/ur/list.urs | 2 ++ src/urweb.grm | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3