Skip to content

Instantly share code, notes, and snippets.

@ghik
Created March 18, 2017 15:56
Show Gist options
  • Save ghik/5d493959a3061097b37f46e1e3fe0469 to your computer and use it in GitHub Desktop.
Save ghik/5d493959a3061097b37f46e1e3fe0469 to your computer and use it in GitHub Desktop.
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