1

I'm learning Scala and I found out that if I have class:

class Foo[A, B]

Then I can start refering to it as A Foo B instead of Foo[A,B] like this:

var a: Int Foo Double = new (Int Foo Double)

I found out about it when learning about <:< class, but no one mentions how is this possible to write it down like that and I can't find any documentation regarding this. Where can I find things like this documented?

I've seen question about instances of synthetic sugar and it contains my finding, but it's also only a finding. I'd like to know where in Scala documentation can I find the source.

Mentioned question: What are all the instances of syntactic sugar in Scala?

Community
  • 1
  • 1
prostynick
  • 6,129
  • 4
  • 37
  • 61

1 Answers1

4

You're looking for Infix Types, from the SLS 3.2.8:

An infix type T1 op T2 consists of an infix operator op which gets applied to two type operands T1 and T2. The type is equivalent to the type application op[T1, T2]. The infix operator op may be an arbitrary identifier.

Michael Zajac
  • 55,144
  • 7
  • 113
  • 138