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 API documentation links #4401

Merged
merged 4 commits into from
Feb 21, 2023
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
3 changes: 3 additions & 0 deletions docs/datatypes/const.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Const

API Documentation: @:api(cats.data.Const)

At first glance `Const` seems like a strange data type - it has two type parameters, yet only
stores a value of the first type. What possible use is it? As it turns out, it does
have its uses, which serve as a nice example of the consistency and elegance of functional programming.
Expand Down
2 changes: 2 additions & 0 deletions docs/datatypes/contt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# ContT

API Documentation: @:api(cats.data.ContT)

A pattern that appears sometimes in functional programming is that of a function
first computing some kind of intermediate result and then passing that result to
another function which was passed in as an argument, in order to delegate the
Expand Down
2 changes: 2 additions & 0 deletions docs/datatypes/eithert.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# EitherT

API Documentation: @:api(cats.data.EitherT)

`Either` can be used for error handling in most situations. However, when
`Either` is placed into effectful types such as `Option` or`Future`, a large
amount of boilerplate is required to handle errors. For example, consider the
Expand Down
2 changes: 2 additions & 0 deletions docs/datatypes/eval.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Eval

API Documentation: @:api(cats.Eval)

Eval is a data type for controlling synchronous evaluation.
Its implementation is designed to provide stack-safety at all times using a technique called trampolining.

Expand Down
2 changes: 2 additions & 0 deletions docs/datatypes/freeapplicative.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Free Applicative

API Documentation: @:api(cats.free.FreeApplicative)

`FreeApplicative`s are similar to `Free` (monads) in that they provide a nice way to represent
computations as data and are useful for building embedded DSLs (EDSLs). However, they differ
from `Free` in that the kinds of operations they support are limited, much like the distinction
Expand Down
2 changes: 2 additions & 0 deletions docs/datatypes/freemonad.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Free Monad

API Documentation: @:api(cats.free.Free)

## What is it?

A *free monad* is a construction which allows you to build a *monad*
Expand Down
3 changes: 3 additions & 0 deletions docs/datatypes/functionk.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# FunctionK

API Documentation: @:api(cats.arrow.FunctionK)

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
Expand Down
2 changes: 2 additions & 0 deletions docs/datatypes/id.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Id

API Documentation: [Id](@API_LINK_BASE@cats/index.html#Id[A]=A)

The identity monad can be seen as the ambient monad that encodes the
effect of having no effect. It is ambient in the sense that plain pure
values are values of `Id`.
Expand Down
2 changes: 2 additions & 0 deletions docs/datatypes/ior.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Ior

API Documentation: @:api(cats.data.Ior)

`Ior` represents an inclusive-or relationship between two data types.
This makes it very similar to the [`Either`](either.md) data type, which represents an "exclusive-or" relationship.
What this means, is that an `Ior[A, B]` (also written as `A Ior B`) can contain either an `A`, a `B`, or both an `A` and `B`.
Expand Down
2 changes: 2 additions & 0 deletions docs/datatypes/iort.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# IorT

API Documentation: @:api(cats.data.IorT)

`IorT[F[_], A, B]` is a light wrapper on an `F[Ior[A, B]]`. Similar to
`OptionT[F[_], A]` and `EitherT[F[_], A, B]`, it is a monad transformer for
`Ior`, that can be more convenient to work with than using `F[Ior[A, B]]`
Expand Down
3 changes: 3 additions & 0 deletions docs/datatypes/kleisli.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Kleisli

API Documentation: @:api(cats.data.Kleisli)

Kleisli enables composition of functions that return a monadic value, for instance an `Option[Int]`
or a `Either[String, List[Double]]`, without having functions take an `Option` or `Either` as a parameter,
which can be strange and unwieldy.
Expand Down
2 changes: 2 additions & 0 deletions docs/datatypes/nel.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# NonEmptyList

API Documentation: @:api(cats.data.NonEmptyList)

## Motivation

We start with two examples of `NonEmptyList`s
Expand Down
8 changes: 5 additions & 3 deletions docs/datatypes/nested.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{% laika.title = Nested %}
# Nested

# Motivation
API Documentation: @:api(cats.data.Nested)

## Motivation

In day-to-day programming we quite often end up with data inside nested
effects, e.g. an integer inside an `Either`, which in turn is nested inside
Expand Down Expand Up @@ -54,7 +56,7 @@ and `G[_]`. For example:

You can see the full list of these rules in the `Nested` companion object.

## A more interesting example
### A more interesting example

(courtesy of [Channing Walton and Luka Jacobowitz via
Twitter](https://twitter.com/LukaJacobowitz/status/1017355319473786880),
Expand Down
2 changes: 2 additions & 0 deletions docs/datatypes/oneand.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# OneAnd

API Documentation: @:api(cats.data.OneAnd)

The `OneAnd[F[_],A]` data type represents a single element of type `A`
that is guaranteed to be present (`head`) and in addition to this a
second part that is wrapped inside an higher kinded type constructor
Expand Down
2 changes: 2 additions & 0 deletions docs/datatypes/optiont.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# OptionT

API Documentation: @:api(cats.data.OptionT)

`OptionT[F[_], A]` is a light wrapper on an `F[Option[A]]`. Speaking technically, it is a monad transformer for `Option`, but you don't need to know what that means for it to be useful. `OptionT` can be more convenient to work with than using `F[Option[A]]` directly.

## Reduce map boilerplate
Expand Down
2 changes: 2 additions & 0 deletions docs/datatypes/state.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# State

API Documentation: @:api(cats.data.IndexedStateT)

`State` is a structure that provides a functional approach to handling application state. `State[S, A]` is basically a function `S => (S, A)`, where `S` is the type that represents your state and `A` is the result the function produces. In addition to returning the result of type `A`, the function returns a new `S` value, which is the updated state.

## Robots
Expand Down
2 changes: 2 additions & 0 deletions docs/datatypes/statet.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# StateT

API Documentation: @:api(cats.data.IndexedStateT)

`StateT[F[_], S, A]` is a data type that generalizes `State` with the
ability to compose with effects in `F[_]`. Because `StateT` is defined
in terms of `F`, it is a monad only if `F` is a monad. Additionally,
Expand Down
2 changes: 2 additions & 0 deletions docs/datatypes/validated.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Validated

API Documentation: @:api(cats.data.Validated)

Imagine you are filling out a web form to signup for an account. You input your username and password and submit.
Response comes back saying your username can't have dashes in it, so you make some changes and resubmit. Can't
have special characters either. Change, resubmit. Passwords need to have at least one capital letter. Change,
Expand Down
2 changes: 2 additions & 0 deletions docs/datatypes/writer.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Writer

API Documentation: @:api(cats.data.WriterT)

The `Writer[L, A]` datatype represents a computation that produces a
tuple containing a value of type `L` and one of type `A`. Usually, the
value `L` represents a description of the computation. A typical
Expand Down
2 changes: 2 additions & 0 deletions docs/datatypes/writert.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# WriterT

API Documentation: @:api(cats.data.WriterT)

`WriterT[F[_], L, V]` is a type wrapper on an `F[(L,
V)]`. Speaking technically, it is a monad transformer for [`Writer`](writer.md),
but you don't need to know what that means for it to be
Expand Down
2 changes: 2 additions & 0 deletions docs/typeclasses/alternative.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Alternative

API Documentation: @:api(cats.Alternative)

Alternative extends [`Applicative`](applicative.md) with a [`MonoidK`](monoidk.md).
Let's stub out all the operations just to remind ourselves what that gets us.

Expand Down
3 changes: 3 additions & 0 deletions docs/typeclasses/applicative.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Applicative

API Documentation: @:api(cats.Applicative)

`Applicative` extends [`Functor`](functor.md) with an `ap` and `pure` method.

```scala mdoc:silent
Expand Down
2 changes: 2 additions & 0 deletions docs/typeclasses/applicativemonaderror.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# ApplicativeError and MonadError

API Documentation: @:api(cats.ApplicativeError), @:api(cats.MonadError)

## Applicative Error

### Description
Expand Down
2 changes: 2 additions & 0 deletions docs/typeclasses/arrow.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Arrow

API Documentation: @:api(cats.arrow.Arrow)

`Arrow` is a type class for modeling composable relationships between two types. One example of such a composable relationship is function `A => B`; other examples include `cats.data.Kleisli`(wrapping an `A => F[B]`, also known as `ReaderT`), and `cats.data.Cokleisli`(wrapping an `F[A] => B`). These type constructors all have `Arrow` instances. An arrow `F[A, B]` can be thought of as representing a computation from `A` to `B` with some context, just like a functor/applicative/monad `F[A]` represents a value `A` with some context.

Having an `Arrow` instance for a type constructor `F[_, _]` means that an `F[_, _]` can be composed and combined with other `F[_, _]`s. You will be able to do things like:
Expand Down
4 changes: 2 additions & 2 deletions docs/typeclasses/arrowchoice.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% laika.title = Arrow Choice %}
# Arrow Choice

# Choice
API Documentation: @:api(cats.arrow.Choice)

Usually we deal with function more often, we're so familiar with `A => B`.

Expand Down
2 changes: 2 additions & 0 deletions docs/typeclasses/bifoldable.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Bifoldable

API Documentation: @:api(cats.Bifoldable)

`Bifoldable[F[_,_]]` instances identify data structures with two independent `Foldable` that fold to the same summary value.

As a reminder `Foldable` is implemented in terms of `foldLeft` and `foldRight`; similarly `Bifoldable` is implemented in terms of:
Expand Down
2 changes: 2 additions & 0 deletions docs/typeclasses/bifunctor.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Bifunctor

API Documentation: @:api(cats.Bifunctor)

`Bifunctor` takes two type parameters instead of one, and is a functor in both
of these parameters. It defines a function `bimap`, which allows for mapping over both
arguments at the same time. Its signature is as follows:
Expand Down
2 changes: 2 additions & 0 deletions docs/typeclasses/bimonad.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Bimonad

API Documentation: @:api(cats.Bimonad)

The `Bimonad` trait directly extends `Monad` and `Comonad` without introducing new methods. `Bimonad` is
different from other `Bi` typeclasses like `Bifunctor`, `Bifoldable` or `Bitraverse` where the prefix describes
a `F[_, _]`. The `Bimonad` is a `F[_]` and the `Bi` prefix has a different meaning here: it's both a `Monad` and a `Comonad`.
Expand Down
2 changes: 2 additions & 0 deletions docs/typeclasses/comonad.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Comonad

API Documentation: @:api(cats.Comonad)

`Comonad` is a `Functor` and provides duals of the [`Monad`](monad.md) `pure`
and `flatMap` functions. A dual to a function has the same types but the
direction of the arrows are reversed. Whether or not that is useful, or even possible,
Expand Down
2 changes: 2 additions & 0 deletions docs/typeclasses/contravariant.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Contravariant

API Documentation: @:api(cats.Contravariant)

The `Contravariant` type class is for functors that define a `contramap`
function with the following type:

Expand Down
2 changes: 2 additions & 0 deletions docs/typeclasses/contravariantmonoidal.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Contravariant Monoidal

API Documentation: @:api(cats.ContravariantMonoidal)

The `ContravariantMonoidal` type class is for [`Contravariant`](contravariant.md) functors that can define a
`product` function and a `unit` function.

Expand Down
2 changes: 2 additions & 0 deletions docs/typeclasses/eq.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Eq

API Documentation: @:api(cats.kernel.Eq)

Eq is an alternative to the standard Java `equals` method.
It is defined by the single method `eqv`:

Expand Down
2 changes: 2 additions & 0 deletions docs/typeclasses/foldable.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Foldable

API Documentation: @:api(cats.Foldable)

Foldable type class instances can be defined for data structures that can be
folded to a summary value.

Expand Down
3 changes: 3 additions & 0 deletions docs/typeclasses/functor.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Functor

API Documentation: @:api(cats.Functor)

`Functor` is a type class that abstracts over type constructors that can be `map`'ed over. Examples of such
type constructors are `List`, `Option`, and `Future`.

Expand Down
2 changes: 2 additions & 0 deletions docs/typeclasses/invariant.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Invariant

API Documentation: @:api(cats.Invariant)

The `Invariant` type class is for functors that define an `imap`
function with the following type:

Expand Down
2 changes: 2 additions & 0 deletions docs/typeclasses/invariantmonoidal.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Invariant Monoidal

API Documentation: @:api(cats.InvariantMonoidal)

`InvariantMonoidal` combines [`Invariant`](invariant.md) and `Semigroupal` with the addition of a `unit` methods, defined in isolation the `InvariantMonoidal` type class could be defined as follows:

```scala mdoc:compile-only
Expand Down
2 changes: 2 additions & 0 deletions docs/typeclasses/monad.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Monad

API Documentation: @:api(cats.Monad)

`Monad` extends the [`Applicative`](applicative.md) type class with a
new function `flatten`. Flatten takes a value in a nested context (eg.
`F[F[A]]` where F is the context) and "joins" the contexts together so
Expand Down
2 changes: 2 additions & 0 deletions docs/typeclasses/monoid.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Monoid

API Documentation: @:api(cats.kernel.Monoid)

`Monoid` extends the power of `Semigroup` by providing an additional `empty` value.

```scala mdoc:silent
Expand Down
2 changes: 2 additions & 0 deletions docs/typeclasses/monoidk.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# MonoidK

API Documentation: @:api(cats.MonoidK)

`MonoidK` is a universal monoid which operates on type constructors of one argument.

This type class is useful when its type parameter `F[_]` has a
Expand Down
2 changes: 2 additions & 0 deletions docs/typeclasses/nonemptytraverse.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# NonEmptyTraverse

API Documentation: @:api(cats.NonEmptyTraverse)

`NonEmptyTraverse` is a non-empty version of the [Traverse](traverse.md) type class, just like [Reducible](reducible.md) is a non-empty version of [Foldable](foldable.md).
As such, it extends both `Reducible` and `Traverse` in the type class hierarchy.
It provides the `nonEmptyTraverse` and `nonEmptySequence` methods that require an instance of `Apply` instead of `Applicative`:
Expand Down
2 changes: 2 additions & 0 deletions docs/typeclasses/parallel.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Parallel

API Documentation: @:api(cats.Parallel)

When browsing the various `Monads` included in Cats,
you may have noticed that some of them have data types that are actually of the same structure,
but instead have instances of `Applicative`. E.g. `Either` and `Validated`.
Expand Down
2 changes: 2 additions & 0 deletions docs/typeclasses/reducible.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Reducible

API Documentation: @:api(cats.Reducible)

`Reducible` extends the `Foldable` type class with additional `reduce` methods.

You may have come by one of the `reduce`, `reduceLeft` or `reduceOption` defined in Scala's standard collections.
Expand Down
2 changes: 2 additions & 0 deletions docs/typeclasses/semigroup.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Semigroup

API Documentation: @:api(cats.kernel.Semigroup)

If a type `A` can form a `Semigroup` it has an **associative** binary operation.

```scala mdoc:silent
Expand Down
2 changes: 2 additions & 0 deletions docs/typeclasses/semigroupk.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# SemigroupK

API Documentation: @:api(cats.SemigroupK)

`SemigroupK` has a very similar structure to [`Semigroup`](semigroup.md), the difference
is that `SemigroupK` operates on type constructors of one argument. So, for
example, whereas you can find a `Semigroup` for types which are fully
Expand Down
2 changes: 2 additions & 0 deletions docs/typeclasses/show.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Show

API Documentation: @:api(cats.Show)

Show is an alternative to the Java `toString` method.
It is defined by a single function `show`:

Expand Down
2 changes: 2 additions & 0 deletions docs/typeclasses/traverse.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Traverse

API Documentation: @:api(cats.Traverse)

In the `Applicative` tutorial we saw a more polymorphic version of the standard library
`Future.traverse` and `Future.sequence` functions, generalizing `Future` to be any
`F[_]` that's `Applicative`.
Expand Down