3

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 @>?

1 Answer 1

4

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.

1
  • Ah, I didn't think to look in the package object. Thanks!
    – Mark
    Jan 5, 2013 at 7:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.