-
Notifications
You must be signed in to change notification settings - Fork 451
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
ListK docs #870
ListK docs #870
Conversation
Closes #322 |
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.
Some small things but I'll approve not to block it
TODO. Meanwhile you can find a short description in the [intro to datatypes]({{ '/docs/datatypes/intro/' | relative_url }}). | ||
ListK wraps over the platform `List` type to make it a (type constructor)[/docs/patterns/glossary/#type-constructors]. | ||
|
||
It can be created from Kotlin Sequence type with a convenient `k()` function. |
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.
Sequence > List
|
||
```kotlin:ank | ||
val numbers = listOf(Math.random(), Math.random(), Math.random()).k() | ||
requests.traverse(Option.applicative()) { if (it > 0.5) Some(it) else None } |
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.
numbers.traverse
?
requests.traverse(Option.applicative()) { if (it > 0.5) Some(it) else None } | ||
``` | ||
|
||
and complements the convenient function `sequence()` that converts a list of `List<Kind<F, A>>` into a `Kind<F, List<A>>`: |
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.
ListK<Kind<F, A>> into a Kind<F, ListK>?
requests.sequence(Option.applicative()).fix() | ||
``` | ||
|
||
A more general approach is aggregating values using `foldLeft` and `foldRight` from [`Foldable`](/docs/typeclasses/foldable). |
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.
Not sure I understand this sentence right. Should it be?
A more general approach for aggregating values?
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'll rewrite.
Codecov Report
@@ Coverage Diff @@
## master #870 +/- ##
============================================
- Coverage 45.37% 45.35% -0.02%
Complexity 652 652
============================================
Files 302 302
Lines 7756 7756
Branches 833 833
============================================
- Hits 3519 3518 -1
Misses 3932 3932
- Partials 305 306 +1
Continue to review full report at Codecov.
|
* ListK docs * Update README.md * Update README.md * Update README.md
It's a glaring omission and at this point we just need it.