Skip to content

Commit

Permalink
.raiseError syntax allows an error subtype
Browse files Browse the repository at this point in the history
  • Loading branch information
guersam committed Sep 19, 2018
1 parent 1911e8b commit e2da593
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/syntax/applicativeError.scala
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ final class ApplicativeErrorExtensionOps[F[_], E](F: ApplicativeError[F, E]) {
}

final class ApplicativeErrorIdOps[E](val e: E) extends AnyVal {
def raiseError[F[_], A](implicit F: ApplicativeError[F, E]): F[A] =
def raiseError[F[_], A](implicit F: ApplicativeError[F, _ >: E]): F[A] =
F.raiseError(e)
}

Expand Down
4 changes: 4 additions & 0 deletions tests/src/test/scala/cats/tests/SyntaxSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@ object SyntaxSuite extends AllSyntaxBinCompat with AllInstances with AllSyntax {
val gea4 = ga.recoverWith(pfegea)
}

def testApplicativeErrorSubtype[F[_], A](implicit F: ApplicativeError[F, CharSequence]): Unit = {
val fea = "meow".raiseError[F, A]
}

def testNested[F[_], G[_], A]: Unit = {
val fga: F[G[A]] = mock[F[G[A]]]

Expand Down

0 comments on commit e2da593

Please sign in to comment.