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

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -