-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add till' #115
base: master
Are you sure you want to change the base?
Add till' #115
Conversation
It would be nice if the commit history were a bit cleaner. Why not just fold the last three commits together? |
-- This complements @manyTill@ and can be used to find a specific | ||
-- pattern in a text. | ||
-- | ||
-- The value returned by @p@ is forced to WHNF. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe this is true, is it?
@bgamari you're right, and |
skipTill' :: (MonadPlus m) => m a -> m b -> m b | ||
skipTill' p end = scan | ||
where scan = end `mplus` (p !*> scan) | ||
(!*>) !a0 a1 = a0 *> a1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will force the m a
but presumably you wanted to instead force the a
, right?
@@ -267,7 +267,7 @@ skipTill p end = scan | |||
skipTill' :: (MonadPlus m) => m a -> m b -> m b | |||
skipTill' p end = scan | |||
where scan = end `mplus` (p !*> scan) | |||
(!*>) !a0 a1 = a0 *> a1 | |||
(!*>) a0 a1 = fmap (\(!a) -> a) a0 *> a1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bgamari This should do it, right?
#93