-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Make Bifoldable docs #4109
Make Bifoldable docs #4109
Conversation
@armanbilge here it is as promised in #4076 👍 |
dd8e3e3
to
b80e565
Compare
f5a9413
to
cb4d28d
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.
Thanks for following up on this!
c785cd8
to
be77729
Compare
d338e89
to
1f12f0c
Compare
@armanbilge I would say this version is final and ready for a re-review. Thanks! |
…tead of `Bifoldable`
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.
👍 from me, thanks again! :)
```scala mdoc | ||
case class Report(entries: List[String], errors: Int) { | ||
def withEntries(entry: String): Report = | ||
this.copy(entries = entries :+ entry) |
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.
appending to the right of a list is an anti-pattern (because it is O(N) and repeatedly doing it can create quadratic performance issues). Can we use Vector[String]
or Chain[String]
if you want to append?
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.
appending to the right of a list is an anti-pattern (because it is O(N) and repeatedly doing it can create quadratic performance issues). Can we use
Vector[String]
orChain[String]
if you want to append?
@johnynek I've switched to Chain[String]]
def bifoldLeft[A, B, C](fab: F[A, B], c: C)(f: (C, A) => C, g: (C, B) => C): C | ||
|
||
//lazily performs a right-associative bi-fold over `fab` | ||
def bifoldRight[A, B, C](fab: F[A, B], c: Eval[C])(f: (A, Eval[C]) => Eval[C], g: (B, Eval[C]) => Eval[C]): Eval[C] |
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.
can we say any laws these must follow? You have a tuple example below which uses an ordering (left to right in your example), but would the other direction also be lawful?
@johnynek could you take a look? Not sure if I managed to address your comments. |
@gatear I'm sorry this has been sitting for so long, but I would like to merge it before our next release. Thanks again for your contribution. |
The first draft for
Bifunctor
docs as required in #1801