简体   繁体   English

具有两个类型参数(即F [A,B]等于AFB)的仿制药的合成糖在哪里记录?

[英]Where is synthetic sugar for generics with two type parameters (ie. that F[A,B] is equal to A F B) documented?

I'm learning Scala and I found out that if I have class: 我正在学习Scala,发现如果我上课:

class Foo[A, B]

Then I can start refering to it as A Foo B instead of Foo[A,B] like this: 然后,我可以开始将其称为A Foo B而不是Foo[A,B]如下所示:

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. 我想知道在Scala文档中可以找到源代码。

Mentioned question: What are all the instances of syntactic sugar in Scala? 提到的问题: Scala中语法糖的所有实例是什么?

You're looking for Infix Types , from the SLS 3.2.8 : 您正在从SLS 3.2.8寻找Infix Types

An infix type T1 op T2 consists of an infix operator op which gets applied to two type operands T1 and T2 . 前缀类型T1 op T2由一个前缀运算符op组成,该运算符适用于两个类型的操作数T1T2 The type is equivalent to the type application op[T1, T2] . 该类型等效于类型应用程序op[T1, T2] The infix operator op may be an arbitrary identifier. 中缀运算符op可以是任意标识符。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将F [A \\ / B]拆分为(F [A],F [B]) - How to split F[A \/ B] into (F[A], F[B]) Scala中f(a,b)和f(a)(b)之间的差异 - Difference between f(a,b) and f(a)(b) in Scala 如何将F [Either [A,B]]转换为Either [F [A],F [B]] - How to transform F[Either[A, B]] to Either[F[A], F[B]] 将Hlist [F [A]]转换为F [B],其中案例类B与A对齐类型 - Transforming a Hlist[F[A]] into F[B] where case class B has aligned types with A `F[_ &lt;: A] &lt;: B` 在类型级别和 `f: A =&gt; B` 在值级别之间的类比 - Analogy between `F[_ <: A] <: B` at type-level and `f: A => B` at value-level 将&#39;A =&gt; F [G [B]]&#39;转换为&#39;F [G [A =&gt; B]&#39;标量 - transform 'A => F[G[B]]' into 'F[G[A=>B]' scala 函数等价于if(p(f(a),f(b))a else b - Functional equivalent of if (p(f(a), f(b)) a else b 电梯[A,B]中下划线的含义(f:A => B):选项[A] =>选项[B] = _映射f - Meaning of underscore in lift[A,B](f: A => B): Option[A] => Option[B] = _ map f def compose [A,B,C](f:B =&gt; C,g:A =&gt; B):A =&gt; C = {f(g(_))}是不是有效的Scala声明? - def compose[A,B,C](f: B => C, g: A => B): A => C = {f(g(_))} is noty valid scala declaration? 协变类型E出现在类型A =&gt; returnerror.Error [E,B]值f的相反位置 - covariant type E occurs in contravariant position in type A => returnerror.Error[E,B] of value f
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM