[Noob] unnamed parameters

  def checkJsonPayload(json: JValue)(request: HttpServletRequest): Option[CodedError] = json match {
case JNothing => Some(codedError)
case _ => None


This has a warning as I don’t use the ‘request’ parameter, but wait!; I remember reading that I can replace request with ‘_’. However, it doesn’t compile.

What am I doing wrong?

You can’t replace request with a _ not sure where you read that but it was either in another context or plain wrong.

You can just ignore the warning, suppress it, or remove the parameter.
Why would you even add it if you do not need it?

If you are overriding a superclass that already defines such a method but your particular implementation doesn’t require that parameter then the compiler should not warn. If rather, you are providing a default implementation that is meant to be overridden and those implementations may use that parameter and that is why you are adding it here you can just use the @unused annotation to suppress the warning.

Re: Why do I need it? - After currying with json, I can build a sequence:

Seq[HttpServletRequest => Option[CodedError]

which then can then execute to get a sequence of CodedErrors. This particular method didn’t have use for request.

It’s a minor warning, so I’ll ignore it. Thanks for response.