Skip to content

Commit 0f73ac9

Browse files
committed
Fixed missing imports
1 parent bf2fe4a commit 0f73ac9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

collections/_posts/2025-09-02-custom-error-types.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ However, the basic idea of MTL itself, divorced from the *datatypes* (like `Eith
4141
The problem has been to find a way to blend all of these constructs together in a way that practically *works* with the ecosystem, is syntactically lightweight, has pleasant type inference and errors, and doesn't confuse the heck out of anyone who touches it. That is a problem we feel we have now solved, at least with errors.
4242

4343
```scala
44+
import cats.Monad
4445
import cats.effect.IO
46+
import cats.mtl.syntax.raise.given
4547
import cats.mtl.{Handle, Raise}
48+
import cats.syntax.applicative.given
4649

4750
// define a domain error type
4851
enum ParseError:
@@ -93,8 +96,11 @@ At the end of the `allow` scope, we call `.rescue`, and this requires us to pass
9396
Oh, and just in case you were wondering, this syntax *does* work on Scala 2 as well, it's just a bit less fancy! Here's the same snippet from above, but with 100% more braces and a lot more explicit types:
9497

9598
```scala
99+
import cats.Monad
96100
import cats.effect.IO
101+
import cats.mtl.syntax.raise._
97102
import cats.mtl.{Handle, Raise}
103+
import cats.syntax.applicative._
98104

99105
// define a domain error type
100106
sealed trait ParseError extends Product with Serializable

0 commit comments

Comments
 (0)