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 grouping to scaladoc for arity methods #2080

Merged
merged 1 commit into from
Dec 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ lazy val docSettings = Seq(
fork in (ScalaUnidoc, unidoc) := true,
scalacOptions in (ScalaUnidoc, unidoc) ++= Seq(
"-Xfatal-warnings",
"-groups",
"-doc-source-url", scmInfo.value.get.browseUrl + "/tree/master€{FILE_PATH}.scala",
"-sourcepath", baseDirectory.in(LocalRootProject).value.getAbsolutePath,
"-diagrams"
Expand Down
57 changes: 57 additions & 0 deletions project/Boilerplate.scala
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,29 @@ object Boilerplate {

block"""
|package cats
|
|/**
| * @groupprio Ungrouped 0
| *
| * @groupname ApArity ap arity
| * @groupdesc ApArity Higher-arity ap methods
| * @groupprio ApArity 999
| *
| * @groupname MapArity map arity
| * @groupdesc MapArity Higher-arity map methods
| * @groupprio MapArity 999
| *
| * @groupname TupleArity tuple arity
| * @groupdesc TupleArity Higher-arity tuple methods
| * @groupprio TupleArity 999
| */
|trait ApplyArityFunctions[F[_]] { self: Apply[F] =>
| def tuple2[A, B](f1: F[A], f2: F[B]): F[(A, B)] = Semigroupal.tuple2(f1, f2)(self, self)
- /** @group ApArity */
- def ap$arity[${`A..N`}, Z](f: F[(${`A..N`}) => Z])($fparams):F[Z] = $apply
- /** @group MapArity */
- def map$arity[${`A..N`}, Z]($fparams)(f: (${`A..N`}) => Z): F[Z] = Semigroupal.map$arity($fparams)(f)(self, self)
- /** @group TupleArity */
- def tuple$arity[${`A..N`}, Z]($fparams): F[(${`A..N`})] = Semigroupal.tuple$arity($fparams)(self, self)
|}
"""
Expand All @@ -210,7 +229,16 @@ object Boilerplate {

block"""
|package cats
|
|/**
| * @groupprio Ungrouped 0
| *
| * @groupname ParMapArity parMap arity
| * @groupdesc ParMapArity Higher-arity parMap methods
| * @groupprio ParMapArity 999
| */
|trait ParallelArityFunctions {
- /** @group ParMapArity */
- def parMap$arity[M[_], F[_], ${`A..N`}, Z]($fparams)(f: (${`A..N`}) => Z)(implicit p: NonEmptyParallel[M, F]): M[Z] =
- p.flatMap.map($nestedProducts) { case ${`nested (a..n)`} => f(${`a..n`}) }
|}
Expand All @@ -234,15 +262,44 @@ object Boilerplate {

block"""
|package cats
|
|/**
| * @groupprio Ungrouped 0
| *
| * @groupname MapArity map arity
| * @groupdesc MapArity Higher-arity map methods
| * @groupprio MapArity 999
| *
| * @groupname ContramapArity contramap arity
| * @groupdesc ContramapArity Higher-arity contramap methods
| * @groupprio ContramapArity 999
| *
| * @groupname ImapArity imap arity
| * @groupdesc ImapArity Higher-arity imap methods
| * @groupprio ImapArity 999
| *
| * @groupname TupleArity tuple arity
| * @groupdesc TupleArity Higher-arity tuple methods
| * @groupprio TupleArity 999
| *
| * @groupname TraverseArity traverse arity
| * @groupdesc TraverseArity Higher-arity traverse methods
| * @groupprio TraverseArity 999
| */
|trait SemigroupalArityFunctions {
- /** @group MapArity */
- def map$arity[F[_], ${`A..N`}, Z]($fparams)(f: (${`A..N`}) => Z)(implicit semigroupal: Semigroupal[F], functor: Functor[F]): F[Z] =
- functor.map($nestedProducts) { case ${`nested (a..n)`} => f(${`a..n`}) }
- /** @group ContramapArity */
- def contramap$arity[F[_], ${`A..N`}, Z]($fparams)(f: Z => (${`A..N`}))(implicit semigroupal: Semigroupal[F], contravariant: Contravariant[F]):F[Z] =
- contravariant.contramap($nestedProducts) { z => val ${`(a..n)`} = f(z); ${`nested (a..n)`} }
- /** @group ImapArity */
- def imap$arity[F[_], ${`A..N`}, Z]($fparams)(f: (${`A..N`}) => Z)(g: Z => (${`A..N`}))(implicit semigroupal: Semigroupal[F], invariant: Invariant[F]):F[Z] =
- invariant.imap($nestedProducts) { case ${`nested (a..n)`} => f(${`a..n`}) } { z => val ${`(a..n)`} = g(z); ${`nested (a..n)`} }
- /** @group TupleArity */
- def tuple$arity[F[_], ${`A..N`}]($fparams)(implicit semigroupal: Semigroupal[F], invariant: Invariant[F]):F[(${`A..N`})] =
- imap$arity($fargsS)((${`_.._`}))(identity)
- /** @group TraverseArity */
- def traverse$arity[F[_], G[_], ${`A..N`}, Z]($fparams)(f: (${`A..N`}) => G[Z])(implicit semigroupal: Semigroupal[F], traverse: Traverse[F], applicative: Applicative[G]): G[F[Z]] =
- traverse.traverse($nestedProducts) { case ${`nested (a..n)`} => f(${`a..n`}) }
|}
Expand Down