I found this construction :
type ->[A,B] = (A,B)
I looked up throught :
- Basic Declarations & Definitions | Scala 2.12
- Redirecting…
without success , could someone explains what does it mean ?
I found this construction :
type ->[A,B] = (A,B)
I looked up throught :
At least i found the answer, it’s just an type alias for tuple
type ->[A,B] = (A,B)
definition
Note that the ->
pair factory method, defined for arbitrary types in Scala’s Predef, is unrelated to this type alias.
The ->
type probably is intended for infix notation, i.e. instead of ->[Int, String]
you’d write Int -> String
. (Infix notation works for any type with two parameters, although it only shines with operator-like type names - you can write Int Either String
, as well.)
Thanks for pointing at ArrowAssoc.
Your link to the FAQ has a section, “Methods provided by implicit conversion”, which talks about ->
.
Unfortunately, the link to an index in the Scaladoc is broken. It used to point here, where the entry for ->
points to ArrowAssoc
. The Scaladoc for that isn’t useful, but at least you know where the operator is introduced, so you could grep for it in the open source project.
I don’t know why it’s called open source instead of greppable source.