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

Add tut doc for FunctionK #1604

Merged
merged 4 commits into from
Apr 20, 2017
Merged

Conversation

ceedubs
Copy link
Contributor

@ceedubs ceedubs commented Apr 15, 2017

I'm sure that there is more that could be done with this, and I'm very
open to recommendations, but I wanted to get something out there.

I'm sure that there is more that could be done with this, and I'm very
open to recommendations, but I wanted to get something out there.
@codecov-io
Copy link

codecov-io commented Apr 15, 2017

Codecov Report

Merging #1604 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1604   +/-   ##
=======================================
  Coverage   93.11%   93.11%           
=======================================
  Files         250      250           
  Lines        3992     3992           
  Branches      138      136    -2     
=======================================
  Hits         3717     3717           
  Misses        275      275

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 4e381d2...3837a08. Read the comment docs.

Copy link
Contributor

@kailuowang kailuowang left a comment

Choose a reason for hiding this comment

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

I like the step by step concpets derivation.

Copy link
Contributor

@edmundnoble edmundnoble left a comment

Choose a reason for hiding this comment

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

Very nice! I am still uncomfortable with this "operates on kinds" malarkey, especially after discussion in #1358, but that should probably be removed en-masse if at all.

@ceedubs
Copy link
Contributor Author

ceedubs commented Apr 19, 2017

@edmundnoble thanks for drawing attention to the "operates on kinds" wording. I agree that it's at best sloppy.

I'm trying to think of what a better alternate wording word be. The ScalaDoc for FunctionK says

FunctionK[F[_], G[_]] is a functor transformation from F to G
in the same manner that function A => B is a morphism from values
of type A to B.

While this is a more accurate description, I think that it's probably not going to be much help to many people who are looking at FunctionK for the first time. I'd prefer something a little more approachable since FunctionK is really a fairly simple concept.

What do you think about something like:

A FunctionK transforms values from one first-order-kinded type (a type that takes a single type parameter, such as List or Option) into another first-order-kinded type. This transformation is universal, meaning that a FunctionK[List, Option] will translate all List[A] values into an Option[A] value for all possible types of A.

This explanation may be easier to understand if we first step back and talk about ordinary functions.

@kailuowang
Copy link
Contributor

A FunctionK transforms values from one first-order-kinded type (a type that takes a single type parameter, such as List or Option)

Will the language here gives people the impression that it won't work for " Either[L, ?]". How about "...such as List, Option or Either[L, ?] if partial unification is enabled"?

@ceedubs
Copy link
Contributor Author

ceedubs commented Apr 19, 2017

@kailuowang I suppose that's a possibility. But I also am hesitant to try to shove much more information into that intro description. Maybe it would be better to provide an example with a type such as Either[L, ?] further down in the document?

- Clean up sloppy usage of the term "kind"
- Mention the `~>` type alias
- Show example of fixing the left of `Either` to make it work with
`FunctionK`.
@ceedubs
Copy link
Contributor Author

ceedubs commented Apr 20, 2017

@edmundnoble @kailuowang @peterneyens I've made some changes:

  • Clean up sloppy usage of the term "kind"
  • Mention the ~> type alias
  • Show example of fixing the left of Either to make it work with FunctionK.

When you get a chance, please take another look and let me know what you think.

@peterneyens
Copy link
Collaborator

We still need to add a menu link.

@ceedubs
Copy link
Contributor Author

ceedubs commented Apr 20, 2017

@peterneyens good catch. I've added the menu link.

@kailuowang
Copy link
Contributor

LGTM 👍

@kailuowang kailuowang merged commit 669a023 into typelevel:master Apr 20, 2017
@kailuowang kailuowang modified the milestone: 1.0.0-MF Apr 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants