diff options
author | Adam Chlipala <adam@chlipala.net> | 2018-04-14 14:17:31 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2018-04-14 14:17:31 -0400 |
commit | 1fef19035d2f3388e9ab0dad1889a4cad5c1ca3e (patch) | |
tree | ab2feca6fc2b56003ce0326ef456e76aae16483d /lib/ur/list.ur | |
parent | 7d4a7a7f92095edfea1cb55a11e037667c2c21da (diff) |
List.existsM
Diffstat (limited to 'lib/ur/list.ur')
-rw-r--r-- | lib/ur/list.ur | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/ur/list.ur b/lib/ur/list.ur index cc533676..a7296552 100644 --- a/lib/ur/list.ur +++ b/lib/ur/list.ur @@ -204,6 +204,21 @@ fun exists [a] f = ex end +fun existsM [m] (_ : monad m) [a] f = + let + fun ex ls = + case ls of + [] => return False + | x :: ls => + b <- f x; + if b then + return True + else + ex ls + in + ex + end + fun foldlMap [a] [b] [c] f = let fun fold ls' st ls = |