Skip to content
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

Merged
merged 4 commits into from
Jun 1, 2018
Merged

ListK docs #870

merged 4 commits into from
Jun 1, 2018

Conversation

pakoito
Copy link
Member

@pakoito pakoito commented May 31, 2018

It's a glaring omission and at this point we just need it.

@pakoito pakoito requested review from raulraja, JorgeCastilloPrz, nomisRev and a team May 31, 2018 23:38
@pakoito
Copy link
Member Author

pakoito commented Jun 1, 2018

Closes #322

Copy link
Member

@nomisRev nomisRev left a 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.
Copy link
Member

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 }
Copy link
Member

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>>`:
Copy link
Member

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).
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll rewrite.

@codecov
Copy link

codecov bot commented Jun 1, 2018

Codecov Report

Merging #870 into master will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ Complexity Δ
...ics/src/main/kotlin/arrow/optics/instances/mapk.kt 87.5% <0%> (-4.17%) 0% <0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 83d9184...12b8331. Read the comment docs.

@pakoito pakoito merged commit 510225a into master Jun 1, 2018
@pakoito pakoito deleted the paco-listkdocs branch June 1, 2018 01:08
@pakoito pakoito mentioned this pull request Jun 2, 2018
RawToast pushed a commit to RawToast/kategory that referenced this pull request Jul 18, 2018
* ListK docs

* Update README.md

* Update README.md

* Update README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants