java - What does this mean in Scala? -
im checking out http4s library, , seeing unknown syntax.
val route = httpservice { case -> root / "hello" => ok("hello world.") }
i looked source, , httpservice object, how rest come in place?
a few pieces of information might when looking @ code this:
- calling object or class function calls appropriate apply method if there one
- parentheses optional
so way rewrite code above be:
val route = httpservice.apply({ case -> root / "hello" => ok("hello world.") })
as noted in diego's answer, function passed apply in case goes sort of http request sort of http response.
Comments
Post a Comment