4

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

[->>[_,_]]
TeaBough
  • 165
  • 6
  • possible duplicate of [In Scala type parameters, what do ->> and ->>> mean?](http://stackoverflow.com/questions/9050107/in-scala-type-parameters-what-do-and-mean) – om-nom-nom Apr 10 '13 at 13:05
  • As with methods of a single argument, generic types / type constructors of two arguments can be used in infix form. That probably makes the name a bit more sensible, since it is presumably meant to be used that way. – Randall Schulz Apr 10 '13 at 16:12

1 Answers1

8

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.

Community
  • 1
  • 1
axel22
  • 32,045
  • 9
  • 125
  • 137
  • Great references, would you mind to add this same answer to the [original question](http://stackoverflow.com/questions/9050107/in-scala-type-parameters-what-do-and-mean) referred to by @om-nom-nom? – pagoda_5b Apr 10 '13 at 14:01