I have a couple of methods on a trait as so:
trait ResourceFactory[+R] {
def using[T](work: R => T): T
def usingAsync[T](work: R => Future[T]): Future[T]
}
Unfortunately there's nothing in the type checker to stop you calling the first using
method with a function returning a Future
. I'd like the compiler to insist that the type of T
in the first method be anything other than Future
, to prevent that mistake - is that possible?
Thanks