on master help sign in
Add `until` function to prelude.
commit663b6709761ad8d41b53ed63ea854a152be56042 authorRobert Clipsham <robert@octarineparrot.com> dateMon 22 Dec 2014, 13:08 (12 years ago) parent40f6534
1 file changed+7
libs/prelude/Prelude.idr+7
libs/prelude/Prelude.idr+7
@@ -441,6 +441,13 @@ syntax "[" [start] "," [next] ".." "]"
441441
442442---- More utilities
443443
444+||| repeatedly apply f to v until p is True
445+partial
446+until : (a -> Bool) -> (a -> a) -> a -> a
447+until p f v with (p v)
448+ | False = until p f (f v)
449+ | True = v
450+
444451curry : ((a, b) -> c) -> a -> b -> c
445452curry f a b = f (a, b)
446453