6

From http://www.playframework.org/documentation/2.0/ScalaTodoList

What does the "~" do and why I don't need a point before map?

val task = {
  get[Long]("id") ~ 
  get[String]("label") map {
    case id~label => Task(id, label)
  }
}

Thanks for your help.

1 Answer 1

2

The ~ operator is inspired from the Scala parser combinators, it allows to extract two column values from a row.

There is no point before map because in Scala you are not required to write points.

Your Answer

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

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