难以理解的 Scala 语法 [英] Incomprehensible syntax in Scala

查看:71
本文介绍了难以理解的 Scala 语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这篇文章中找到了以下代码(http://hseeberger.wordpress.com/2010/11/25/introduction-to-category-theory-in-scala/).

I have the following code that I found in this article (http://hseeberger.wordpress.com/2010/11/25/introduction-to-category-theory-in-scala/).

trait GenericCategory[->>[_, _]] {
  def id[A]: A ->> A
  def compose[A, B, C](g: B ->> C, f: A ->> B): A ->> C
}

我无法弄清楚特征名称旁边的语法

I can't figure out the syntax right next to the trait's name

[->>[_,_]]

推荐答案

这是一个 更高级的类型,在本介绍中进行了很好的描述 以及这篇研究论文.

It's a higher-kinded type, described nicely in this introduction and in this research paper.

您可能会感到困惑的原因是 ->> 是高级类型的名称——它也可能被称为 Arrow相反.

The reason you might find it confusing is that ->> is the name for the higher-kinded type -- it might have as well been called Arrow instead.

这篇关于难以理解的 Scala 语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆