diff options
-rw-r--r-- | lib/ur/list.ur | 10 | ||||
-rw-r--r-- | lib/ur/list.urs | 2 | ||||
-rw-r--r-- | src/urweb.grm | 2 |
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 |