From 9f989243a044e6f3e85a9254fa896140090d0b2d Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Fri, 12 May 2017 18:00:03 +0100 Subject: [PATCH] Add symbols to FAQ (#1573) * Add symbols to FAQ * Correct location of inject symbols * Add nicknames * Use html to render pipes within markdown * Add arrow symbols --- docs/src/main/tut/faq.md | 35 ++++++++++++++++++++++++ docs/src/main/tut/typeclasses/symbols.md | 31 --------------------- 2 files changed, 35 insertions(+), 31 deletions(-) delete mode 100644 docs/src/main/tut/typeclasses/symbols.md diff --git a/docs/src/main/tut/faq.md b/docs/src/main/tut/faq.md index 3cc2626efe..3aff209f51 100644 --- a/docs/src/main/tut/faq.md +++ b/docs/src/main/tut/faq.md @@ -21,6 +21,7 @@ position: 4 * [What do types like `?` and `λ` mean?](#kind-projector) * [What does `macro Ops` do? What is `cats.macros.Ops`?](#machinist) * [What is `tailRecM`?](#tailrecm) + * [What does this symbol mean?](#symbol) * [How can I help?](#contributing) ## What imports do I need? @@ -202,6 +203,40 @@ If you're having trouble figuring out how to implement `tailRecM` lawfully, you In some cases you may decide that providing a lawful `tailRecM` may be impractical or even impossible (if so we'd like to hear about it). For these cases we provide a way of testing all of the monad laws _except_ for the stack safety of `tailRecM`: just replace `MonadTests[F].monad[A, B, C]` in your tests with `MonadTests[F].stackUnsafeMonad[A, B, C]`. + +## What does this symbol mean? + +Below is a list of symbols used in cats. + +The `~>`, `⊥`, `⊤`, `:<:` and `:≺:` symbols can be imported with `import cats._`. + +All other symbols can be imported with `import cats.implicits._` + +| Symbol | Name | Nickname | Type Class | Signature | +| -------------------------------- | ---------------------- | ---------------- | ----------------------- | --------------------------------------------------------- | +| fa |@| fb | Cartesian builder | Cinnabon, scream | `Cartesian[F[_]]` | |@|(fa: F[A])(fb: F[B]): F[(A, B)] | +| `fa *> fb` | right apply | | `Cartesian[F[_]]` | `*>(fa: F[A])(fb: F[B]): F[A]` | +| `fa <* fb` | left apply | | `Cartesian[F[_]]` | `<*(fa: F[A])(fb: F[B]): F[B]` | +| `x === y` | equals | | `Eq[A]` | `eqv(x: A, y: A): Boolean` | +| `x =!= y` | not equals | | `Eq[A]` | `neqv(x: A, y: A): Boolean` | +| `fa >>= f` | flatMap | | `FlatMap[F[_]]` | `flatMap(fa: F[A])(f: A => F[B]): F[B]` | +| `fa >> fb` | followed by | | `FlatMap[F[_]]` | `followedBy(fa: F[A])(fb: F[B]): F[B]` | +| `fa << fb` | for effect | | `FlatMap[F[_]]` | `forEffect(fa: F[A])(fb: F[B]): F[A]` | +| x |-| y | remove | | `Group[A]` | `remove(x: A, y: A): A` | +| `x > y` | greater than | | `PartialOrder[A]` | `gt(x: A, y: A): Boolean` | +| `x >= y` | greater than or equal | | `PartialOrder[A]` | `gteq(x: A, y: A): Boolean` | +| `x < y` | less than | | `PartialOrder[A]` | `lt(x: A, y: A): Boolean` | +| `x <= y` | less than or equal | | `PartialOrder[A]` | `lteq(x: A, y: A): Boolean` | +| x |+| y | Semigroup combine | | `Semigroup[A]` | `combine(x: A, y: A): A` | +| `x <+> y` | SemigroupK combine | | `SemigroupK[F[_]]` | `combineK(x: F[A], y: F[A]): F[A]` | +| `f <<< g` | Arrow compose | | `Compose[F[_, _]]` | `compose(f: F[B, C], g: F[A, B]): F[A, C]` | +| `f >>> g` | Arrow andThen | | `Compose[F[_, _]]` | `andThen(f: F[B, C], g: F[A, B]): F[A, C]` | +| `F ~> G` | natural transformation | | `FunctionK[F[_], G[_]]` | `FunctionK` alias | +| `F :<: G` | injectK | | `InjectK[F[_], G[_]]` | `InjectK` alias | +| `F :≺: G` | injectK | | `InjectK[F[_], G[_]]` | `InjectK` alias | +| `⊥` | bottom | | N/A | `Nothing` | +| `⊤` | top | | N/A | `Any` | + ## How can I help? The cats community welcomes and encourages contributions, even if you are completely new to cats and functional programming. Here are a few ways to help out: diff --git a/docs/src/main/tut/typeclasses/symbols.md b/docs/src/main/tut/typeclasses/symbols.md deleted file mode 100644 index bb8a796b6d..0000000000 --- a/docs/src/main/tut/typeclasses/symbols.md +++ /dev/null @@ -1,31 +0,0 @@ -#Symbols - -Below is a list of symbols used in cats. - -The `~>`, `⊥` and `⊤` symbols can be imported with `import cats._`. - -All other symbols can be imported with `import cats.implicits._` - -A scaladoc generated list is also available on the [Scaladoc symbols page](http://typelevel.org/cats/api/#index.index-_). - -| Symbol | Name | Type Class | Definition | -| ---------- | ---------------------- | ---------------------------------------------------------------------------------------- |--------------------------------------- | -| `fa |@| fb`| Cartesian builder | [`Cartesian[F[_]]`]({{ site.sources }}/core/src/main/scala/cats/Cartesian.scala) | `|@|(fa: F[A])(fb: F[B]): F[(A, B)]` | -| `fa *> fb` | right apply | [`Cartesian[F[_]]`]({{ site.sources }}/core/src/main/scala/cats/Cartesian.scala) | `*>(fa: F[A])(fb: F[B]): F[A]` | -| `fa <* fb` | left apply | [`Cartesian[F[_]]`]({{ site.sources }}/core/src/main/scala/cats/Cartesian.scala) | `<*(fa: F[A])(fb: F[B]): F[B]` | -| `x === y` | equals | [`Eq[A]`]({{ site.sources }}/kernel/src/main/scala/cats/kernel/Eq.scala) | `eqv(x: A, y: A): Boolean` | -| `x =!= y` | not equals | [`Eq[A]`]({{ site.sources }}/kernel/src/main/scala/cats/kernel/Eq.scala) | `neqv(x: A, y: A): Boolean` | -| `fa >>= f` | flatMap | [`FlatMap[F[_]]`]({{ site.sources }}/core/src/main/scala/cats/FlatMap.scala) | `flatMap(fa: F[A])(f: A => F[B]): F[B]`| -| `fa >> fb` | followed by | [`FlatMap[F[_]]`]({{ site.sources }}/core/src/main/scala/cats/FlatMap.scala) | `followedBy(fa: F[A])(fb: F[B]): F[B]` | -| `x |-| y` | remove | [`Group[A]`]({{ site.sources }}/kernel/src/main/scala/cats/kernel/Group.scala) | `remove(x: A, y: A): A` | -| `x > y` | greater than | [`PartialOrder[A]`]({{ site.sources }}/kernel/src/main/scala/cats/kernel/PartialOrder.scala)| `gt(x: A, y: A): Boolean` | -| `x >= y` | greater than or equal | [`PartialOrder[A]`]({{ site.sources }}/kernel/src/main/scala/cats/kernel/PartialOrder.scala)| `gteq(x: A, y: A): Boolean` | -| `x < y` | less than | [`PartialOrder[A]`]({{ site.sources }}/kernel/src/main/scala/cats/kernel/PartialOrder.scala)| `lt(x: A, y: A): Boolean` | -| `x <= y` | less than or equal | [`PartialOrder[A]`]({{ site.sources }}/kernel/src/main/scala/cats/kernel/PartialOrder.scala)| `lteq(x: A, y: A): Boolean` | -| `x |+| y` | Semigroup combine | [`Semigroup[A]`]({{ site.sources }}/kernel/src/main/scala/cats/kernel/Semigroup.scala) | `combine(x: A, y: A): A` | -| `x <+> y` | SemigroupK combine | [`SemigroupK[F[_]]`]({{ site.sources }}/core/src/main/scala/cats/SemigroupK.scala) | `combineK(x: F[A], y: F[A]): F[A]` | -| `F ~> G` | natural transformation | [`FunctionK[F[_], G[_]]`]({{ site.sources }}/core/src/main/scala/cats/arrow/FunctionK.scala)| `FunctionK` alias | -| `F :<: G` | inject | [`InjectK[F[_], G[_]]`]({{ site.sources }}/free/src/main/scala/cats/free/package.scala) | `InjectK` alias | -| `F :≺: G` | inject | [`InjectK[F[_], G[_]]`]({{ site.sources }}/free/src/main/scala/cats/free/package.scala) | `InjectK` alias | -| `⊥` | bottom | [N/A]({{ site.sources }}/core/src/main/scala/cats/package.scala) | `Nothing` | -| `⊤` | top | [N/A]({{ site.sources }}/core/src/main/scala/cats/package.scala) | `Any` |