New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nothing
does not conform to arbitrary type parameter
#9453
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9453?orig=1 |
@retronym said: |
@milessabin said (edited on Sep 1, 2015 3:02:26 PM UTC): type ReallyNothing = Nothing { type T = Unit } ie. scala> :paste
// Entering paste mode (ctrl-D to finish)
trait Stuff[A]
def take[A](st: Stuff[A]): Stuff[A] = st
take(??? : Stuff[ReallyNothing])
// Exiting paste mode, now interpreting.
scala.NotImplementedError: an implementation is missing
at scala.Predef$.$qmark$qmark$qmark(Predef.scala:225)
... 37 elided |
@pchiusano said (edited on Oct 13, 2015 8:26:37 PM UTC): I have a The problem is when calling a function like this one: def pull[F[_],A,B](s: Stream[F,A])(using: Handle[F,A] => Pull[F,B,Any]): Stream[F,B] in conjunction with a polymorphic function like def take[F[_],I]: Handle[F,I] => Pull[F,I,Handle[F,I]] The issue is that Scala won't infer val purePull = Stream.pull[Nothing,Int,Int](Stream(1,2,3,4))(process1.take[Nothing,Int](2)) Both those annotations are needed. Not very good. :( What stops me from directly using the dummy refinement trick Miles mentions above is that I am relying on the fact that |
This bug is on the second to last page 😄 #1570 |
Result:
The error goes away if either:
take[Nothing](??? : Stuff[Nothing])
)A
is covariantA
occurs in covariant position in return type oftake
or does not occur at allOriginal SO question: http://stackoverflow.com/questions/32097291/bizzare-type-inference-limitation-multiple-type-params
The text was updated successfully, but these errors were encountered: