-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Documentation refresh for monad transformers #4724
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
laika.title = Monad Transformers | ||
laika.navigationOrder = [ | ||
index.md | ||
contt.md | ||
eithert.md | ||
iort.md | ||
nested.md | ||
optiont.md | ||
statet.md | ||
writert.md | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,14 @@ | |
|
||
API Documentation: @:api(cats.data.EitherT) | ||
|
||
@:callout(warning) | ||
|
||
`EitherT` can interact poorly with more powerful effect types that provide concurrent computation, such as Cats Effect's `IO` or fs2's `Stream`. Because `IO` already provides its own error channel, `EitherT[IO, Throwable]` can lead to confusing behavior; prefer `IO`'s own error channel instead of carrying a second throwable error channel. | ||
|
||
@:@ | ||
|
||
`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 | ||
`Either` is placed into effectful types such as `Option`, a large | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's still an example using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ya. Examples are awkward since one of the big motivations is |
||
amount of boilerplate is required to handle errors. For example, consider the | ||
following program: | ||
|
||
|
@@ -65,8 +71,7 @@ handle the errors will increase dramatically. | |
`EitherT[F[_], A, B]` is a lightweight wrapper for `F[Either[A, B]]` that makes | ||
it easy to compose `Either`s and `F`s together. To use `EitherT`, values of | ||
`Either`, `F`, `A`, and `B` are first converted into `EitherT`, and the | ||
resulting `EitherT` values are then composed using combinators. For example, the | ||
asynchronous division program can be rewritten as follows: | ||
resulting `EitherT` values are then composed using combinators. For example, the asynchronous division program can be rewritten as follows: | ||
|
||
```scala mdoc:nest | ||
import cats.data.EitherT | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer to use
cats.*
as it is back-ported to scala 2, and underscore import is deprecated in scala 3. Similar in other places.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is one existing usage of a
.*
import in the docs. If we change it, I would much rather see it done as a separate PR doing the replacement everywhere.