Created
March 18, 2017 15:56
-
-
Save ghik/5d493959a3061097b37f46e1e3fe0469 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import scala.language.higherKinds | |
sealed abstract class Stuff[+A] | |
case class Suspend[A](a: () => mutable.Set[A]) | |
extends Stuff[A] | |
def extract[A](source: Stuff[A]): Suspend[A] = | |
source match { | |
case ref @ Suspend(_) => ref | |
} | |
//<pastie>:25: error: type mismatch; | |
// found : Suspend[?A1] where type ?A1 <: A (this is a GADT skolem) | |
// required: Suspend[A] | |
//Note: ?A1 <: A, but class Suspend is invariant in type A. | |
//You may wish to define A as +A instead. (SLS 4.5) | |
// case ref @ Suspend(_) => ref | |
// ^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment