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?
You're looking for Infix Types , from the SLS 3.2.8 :
An infix type
T1 op T2
consists of an infix operatorop
which gets applied to two type operandsT1
andT2
. The type is equivalent to the type applicationop[T1, T2]
. The infix operatorop
may be an arbitrary identifier.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.