docs: improve Func and AppFunc documentation - #4890
Open
mmustafasenoglu wants to merge 2 commits into
Open
Conversation
The existing scaladoc for Func was only 2 lines and linked to a 25-page Haskell paper. This adds comprehensive documentation explaining: - What Func is and how it differs from Kleisli - The distinction between sequential (Kleisli) and parallel (Func) composition - Usage examples with AppFunc (product, compose, andThen, traverse) - A new website documentation page (docs/datatypes/func.md) - Type class instances overview Closes typelevel#2650
LukaJCB
reviewed
Aug 3, 2026
| * scala> val double: Func[Option, String, Double] = Func.func(s => scala.util.Try(s.toDouble).toOption) | ||
| * | ||
| * scala> // Compose in parallel: parse and double the same input independently | ||
| * scala> val combined: Func[Option, String, (Int, Double)] = parseInt.product(double) |
Member
There was a problem hiding this comment.
This doesn't really parse and double the input, it parses it into both Int and Double simultaneously.
Author
|
Good catch, fixed the comment wording! Now it says "parse the same input into both Int and Double simultaneously" instead of the misleading "parse and double". |
Author
|
Good catch, thanks! The wording was ambiguous since is both the variable name and a verb. Updated to clarify that it parses the input into both types simultaneously. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Improves the documentation for
FuncandAppFuncdata types, which previously had minimal scaladoc (2 lines linking to a 25-page Haskell paper) and no website documentation.Motivation
The issue #2650 was opened by @tpolecat in 2018 noting that "Nobody knows what the hell
Funcdoes." This PR addresses that by adding comprehensive documentation.Changes
core/src/main/scala/cats/data/Func.scala: Expanded scaladoc forFunc,AppFunc, and all public methods with examplesdocs/datatypes/func.md(new): Website documentation page explaining:product,compose,andThen,traversedocs/datatypes/directory.conf: Addedfunc.mdto navigationTesting
Closes #2650