-
Notifications
You must be signed in to change notification settings - Fork 24
Foldable1 instance #27
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
Conversation
I think this is a breaking change unfortunately, so will have to wait a little bit (as it imposes |
b66f2da
to
81571f6
Compare
I've amended the PR to be non-breaking, by simply reusing the previous implementations. It's nicer to have the looser constraint anyway, no? |
src/Data/NonEmpty.purs
Outdated
@@ -117,3 +109,7 @@ instance traversableWithIndexNonEmpty | |||
=> TraversableWithIndex (Maybe i) (NonEmpty f) where | |||
traverseWithIndex f (a :| fa) = | |||
NonEmpty <$> f Nothing a <*> traverseWithIndex (f <<< Just) fa | |||
|
|||
instance foldable1NonEmpty :: Foldable f => SF.Foldable1 (NonEmpty f) where |
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.
SF
?
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.
San Francisco?
I was thinking _S_emigroup._F_oldable. But yeah, it's crappy. I changed it to F1
.
81571f6
to
551a7eb
Compare
Looks good, but this is still potentially breaking if you were relying on the monomorphic signatures for type inference. |
Good point. Perhaps the right solution is to export monomorphic versions of the instance functions? |
That sounds good to me. |
551a7eb
to
651d3b4
Compare
Done. This is now non-breaking. Ready for review. |
convert fold1 and foldMap1 to instance methods
Solves #26