0

Consider an example:

public def someFunc(f: (One Pair Two Pair Three) => Future[Two]) : SomeResultType = {...}

case class One(...)
case class Two(...)
case class Three(...)

Pair is scala.Predef#Pair What does scala.Predef#Pair mean? As I know I can write function calls in scala like this println "string" but in that case token are types. What does the actual type of expression One Pair Two Pair Three?

1 Answer 1

3

You could use REPL to get your answer:

scala> def ttt: Int Pair Long Pair String = ???
ttt: Pair[Pair[Int,Long],String]

Type A B C means B[A, C] in scala.

So One Pair Two Pair Three means Pair[One,Two] Pair Three means Pair[Pair[One, Two], Three].

Pair is just a type alias to Tuple2.

Note that Pair is deprecated, you should use Tuple2 instead: ((One, Two), Three).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.