Domanda

I've been reading the source for scalaz's Lenses, which you can find at https://github.com/scalaz/scalaz/blob/scalaz-seven/core/src/main/scala/scalaz/Lens.scala

Starting at line 303, there are functions that return values of type @>[A,B]. Is this type an alias for Lens? This makes sense to me from context and from the shape of the symbols, which might represent a beam of light going into a circular lens.

But then why are other functions returning Lens[A,B] instead of the funky alias? I did a search for this symbol in the file, and in the files imported by Lens.scala, but to no avail.

Where can I find the definition of @>?

È stato utile?

Soluzione

Yes, it's a type alias, and most of these convenience type aliases—including @>, but also things like Reader, State, and even Lens itself, which is a type alias for LensFamily[...]—live in the scalaz package object in core/src/main/scala/scalaz/package.scala.

The fact that A @> B is used in some places and Lens[A, B] in others is almost certainly just the result of historical accident and the preferences of particular authors.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top