diff options
author | Adam Chlipala <adam@chlipala.net> | 2019-02-10 18:01:46 -0500 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2019-02-10 18:01:46 -0500 |
commit | b9ddbe0ce5c700fef313788fda5c7ecb82c84638 (patch) | |
tree | 6242b196f0948c3fcb6509c0ab7b33243c739f6b /lib/ur/list.ur | |
parent | 0aab3f48920058051d61215f23440d1042659c92 (diff) |
List.searchM and ListPair.unzip
Diffstat (limited to 'lib/ur/list.ur')
-rw-r--r-- | lib/ur/list.ur | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/ur/list.ur b/lib/ur/list.ur index 10877420..b38097b7 100644 --- a/lib/ur/list.ur +++ b/lib/ur/list.ur @@ -293,6 +293,20 @@ fun search [a] [b] f = search' end +fun searchM [m] (_ : monad m) [a] [b] f = + let + fun search' ls = + case ls of + [] => return None + | x :: ls => + o <- f x; + case o of + None => search' ls + | v => return v + in + search' + end + fun foldlM [m] (_ : monad m) [a] [b] f = let fun foldlM' acc ls = |