Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Incomprehensible syntax in Scala

Tags:

syntax

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

[->>[_,_]]
like image 361
TeaBough Avatar asked Feb 17 '23 20:02

TeaBough


1 Answers

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

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.

like image 143
axel22 Avatar answered Feb 27 '23 02:02

axel22