2

As seen in Alexej's answer for this question, when running sequence on a Seq[Validation[X, A]] you need a boilerplaty explicit type parameters sequence[({type L[Y] = Validation[X, Y]})#L, Y].

The same need may happen with other datatypes / functions.

The questions related to eliminating the need for such explicit types via improving type inference are:

  • Is it theoretically possible to do in Scala?

  • If yes, is this on the Scala roadmap? When can the solution be expected?

  • If not on the roadmap, then is the solution easy / moderate / hard to achieve?

  • Can a mere human do anything to advance the case?

Any pointers regarding the issue welcome.

(Here is a slightly related issue, but not discussing the future perspective)

Community
  • 1
  • 1
ron
  • 9,262
  • 4
  • 40
  • 73

1 Answers1

0

retronym says here What are type lambdas in Scala and what are their benefits? that a future version of scala could improve this. So I guess that it is possible to improve the syntax. But, as far as I understand, we are facing some impossibility in Scala due to subtyping

Community
  • 1
  • 1
bhericher
  • 667
  • 4
  • 13
  • If I understand correctly, Retronym references that future Scala could improve on the type lambda syntax, not on actually eliminating its need. – ron May 30 '12 at 09:51
  • You can't eliminate it. How could you express a binary type constructor as an unary type constructor without it ? – Yo Eight May 30 '12 at 14:38
  • That being said, it could be less uglier – Yo Eight May 30 '12 at 14:48
  • @YoEight I mean eliminating the need for it in the actual case (via inferring the types). The type lambda construct can stay in general of course. – ron May 31 '12 at 09:55
  • That would be great but I don't think it's possible because you could express type L[Y] = Validation[X, Y] or type L[X] = Validation[X, Y]. How the compiler can choose between those possibilities? – Yo Eight Jun 01 '12 at 08:19