-
Notifications
You must be signed in to change notification settings - Fork 52
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 FoldM1 #219
base: main
Are you sure you want to change the base?
Add FoldM1 #219
Conversation
095f66c
to
49b9b86
Compare
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.
Just one comment, otherwise this looks great!
src/Control/Foldl/NonEmpty.hs
Outdated
@@ -375,16 +601,77 @@ minimumBy cmp = Fold1 (\begin -> Fold min' begin id) | |||
_ -> x | |||
{-# INLINABLE minimumBy #-} | |||
|
|||
-- | Upgrade a fold to accept the 'Fold1' type | |||
-- | Upgrade a "non-empty" fold to accept the 'Fold1' type |
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 think you want to escape quotes, otherwise haddock tries to interpret them as a module reference. Same comment for the other quotes in the documentation:
-- | Upgrade a "non-empty" fold to accept the 'Fold1' type | |
-- | Upgrade a \"non-empty\" fold to accept the 'Fold1' type |
a902c0c
to
67c7826
Compare
With background shading the rounded corners between two immediately consecutive inline code spans would be visible. Merges these inline code spans into a single one to avoid this.
I do not export the constructor
FoldM1'
. Instead I export the pattern synonymFoldM1
, which has a Monad constraint. This way we retain the option to later change the datatype definition toNote that currently
hoists
or the Functor instance can only be implemented withFoldM1'
because they do not requireMonad m
.I also changed the handler type signatures from
Handler a b
toHandler s a
to match thes t a b
naming scheme for optics.