From 0f73ac911fd6ee3fbccb8b6b04cfb2967198c094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastian=20Le=20Merdy?= Date: Sat, 27 Sep 2025 15:43:03 +0200 Subject: [PATCH 1/2] Fixed missing imports --- collections/_posts/2025-09-02-custom-error-types.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/collections/_posts/2025-09-02-custom-error-types.md b/collections/_posts/2025-09-02-custom-error-types.md index aa62ce4..9030191 100644 --- a/collections/_posts/2025-09-02-custom-error-types.md +++ b/collections/_posts/2025-09-02-custom-error-types.md @@ -41,8 +41,11 @@ However, the basic idea of MTL itself, divorced from the *datatypes* (like `Eith 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. ```scala +import cats.Monad import cats.effect.IO +import cats.mtl.syntax.raise.given import cats.mtl.{Handle, Raise} +import cats.syntax.applicative.given // define a domain error type enum ParseError: @@ -93,8 +96,11 @@ At the end of the `allow` scope, we call `.rescue`, and this requires us to pass 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: ```scala +import cats.Monad import cats.effect.IO +import cats.mtl.syntax.raise._ import cats.mtl.{Handle, Raise} +import cats.syntax.applicative._ // define a domain error type sealed trait ParseError extends Product with Serializable From 47b9dea0c6af1b667ca0528c7a7a35a766e74e72 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sat, 31 Jan 2026 13:01:39 -0800 Subject: [PATCH 2/2] Tweak imports --- collections/_posts/2025-09-02-custom-error-types.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/collections/_posts/2025-09-02-custom-error-types.md b/collections/_posts/2025-09-02-custom-error-types.md index 9030191..44c2957 100644 --- a/collections/_posts/2025-09-02-custom-error-types.md +++ b/collections/_posts/2025-09-02-custom-error-types.md @@ -43,9 +43,9 @@ The problem has been to find a way to blend all of these constructs together in ```scala import cats.Monad import cats.effect.IO -import cats.mtl.syntax.raise.given +import cats.mtl.syntax.all.* import cats.mtl.{Handle, Raise} -import cats.syntax.applicative.given +import cats.syntax.all.* // define a domain error type enum ParseError: @@ -98,9 +98,9 @@ Oh, and just in case you were wondering, this syntax *does* work on Scala 2 as w ```scala import cats.Monad import cats.effect.IO -import cats.mtl.syntax.raise._ +import cats.mtl.syntax.all._ import cats.mtl.{Handle, Raise} -import cats.syntax.applicative._ +import cats.syntax.all._ // define a domain error type sealed trait ParseError extends Product with Serializable