mirror of
https://github.com/github/semantic.git
synced 2024-12-21 22:01:46 +03:00
Add callstacks to while & until.
This commit is contained in:
parent
56eb9407b9
commit
59fd521709
@ -163,14 +163,14 @@ children forEach = withFrozenCallStack $ Children forEach `Then` return
|
||||
|
||||
|
||||
-- | Collect a list of values passing a predicate.
|
||||
while :: (Alternative m, Monad m) => (a -> Bool) -> m a -> m [a]
|
||||
while :: (Alternative m, Monad m, HasCallStack) => (a -> Bool) -> m a -> m [a]
|
||||
while predicate step = many $ do
|
||||
result <- step
|
||||
guard (predicate result)
|
||||
pure result
|
||||
|
||||
-- | Collect a list of values failing a predicate.
|
||||
until :: (Alternative m, Monad m) => (a -> Bool) -> m a -> m [a]
|
||||
until :: (Alternative m, Monad m, HasCallStack) => (a -> Bool) -> m a -> m [a]
|
||||
until = while . (not .)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user