Created
January 4, 2020 17:51
-
-
Save djspiewak/ac72649347dc2ce3c384f996d3ea7a58 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> run(F.raiseError[String](42).map(_.asRight[Int]).handleErrorWith(_.asLeft[String].pure[PureConc[Int, ?]])) | |
res11: ce3.ExitCase[Option,Int,Either[Int,String]] = Completed(Some(Left(42))) | |
scala> run(F.attempt(F.raiseError[String](42))) | |
res12: ce3.ExitCase[Option,Int,Either[Int,String]] = Errored(42) |
Wow! That is absolutely fascinating and concerning.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, I ran into a similar issue today.
Effect definition:
Example #1:
The compiler chooses
EitherT.catsDataMonadErrorForEitherT
asMonadError
instance and evaluation fails.Example #2:
In this case, the compiler chooses
EitherT.catsDataMonadErrorFForEitherT
and everything works fine.The
catsDataMonadErrorForEitherT
has higher priority thencatsDataMonadErrorFForEitherT
until the error type is not provided explicitly.