What is List[String~Int]?

playframework, playframework-2.0, scala

Solution

May be this willl help:

scala> class ~[A, B]
defined class $tilde

scala> List.empty[String~Int]
res1: List[~[String,Int]] = List()

Actually, `~` is not a part of the standard library, this is a generic class from the play framework, which allows an infix notation. In scala, any generic class that takes 2 generic parameters can be use with an infix notation. for example, the following also works:

scala> class X[A, B]
defined class X

scala> List.empty[String X Int]
res1: List[X[String,Int]] = List()

In your case, you will find the definition of `~` in the Play framework API.

Problem

While going through the scala documentation (Play Docs) of the play framework I saw a syntax I have never seen before. ``` val populations:List[String~Int] = { SQL("select * from Country").as( str("name") ~ int("population") * ) } ``` Could someone please tell me what does "~" in `List[String~Int]` mean?

Original source