Skip to content

Commit 3a32c0e

Browse files
committed
Remove a wrong type argument in IO.interpret
In a compiler patch that changes the way type variables are maximised in typedUnapply the code would throw the following type error: .handleError(t => Right((t.asLeft[IO[B]], limit - 1))) // ^^^^^^^^^^^^^^^ // Found: Either[Throwable, cats.effect.IO[B]] // Required: B // // where: B is a type in methodinterpret with bounds >: Either[Throwable, A$1] Turns out the right type argument for the RHS of Either is A, not IO[B], and it's only because that type variable was instantiated to Any or Nothing was it fine to use `IO[B]` instead. Additionally there's some kind of type inference interaction with the choice of Right.apply and asRight, which I didn't look into further - I just switched to using asRight.
1 parent 1df408d commit 3a32c0e

File tree

1 file changed

+1
-1
lines changed
  • core/shared/src/main/scala/cats/effect

1 file changed

+1
-1
lines changed

core/shared/src/main/scala/cats/effect/IO.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ sealed abstract class IO[+A] private () extends IOPlatform[A] {
927927
case Left(_) => Left(io)
928928
case Right((a, limit)) => Right((a.asRight[Throwable], limit))
929929
}
930-
.handleError(t => Right((t.asLeft[IO[B]], limit - 1)))
930+
.handleError(t => (t.asLeft, limit - 1).asRight)
931931

932932
case IO.HandleErrorWith(ioe, f, _) =>
933933
interpret(ioe, limit - 1)

0 commit comments

Comments
 (0)