Scala: type annotations make tail recursion check fail

前端 未结 1 1704
一个人的身影
一个人的身影 2021-01-29 00:22

I\'m adding type annotations to this pattern match just for my own understanding.

@annotation.tailrec def run[A](io: IO[A]): A = {
  io match {
    case Return(a         


        
相关标签:
1条回答
  • 2021-01-29 01:08

    Bonus answer: There are a lot of questions about type erasure, take a look at How do I get around type erasure on Scala? Or, why can't I get the type parameter of my collections? You can write something like

        case FlatMap(y: IO[A], g: gType@unchecked) if g.isInstanceOf[gType] =>
    
    0 讨论(0)
提交回复
热议问题