Your way of doing things seems wonderful. Alternatively, you can take advantage of the fact that casestatement PartialFunctionand use this. Unfortunately, the conclusion of the Scala finicky type makes it more verbose than necessary (otherwise it would be a pretty nice idiom).
val filtered0 = headers.filterNot({ case Authorization(_) =>}.isDefinedAt)
val filtered1 = headers.filterNot(({ case Authorization(_) =>}: PartialFunction[spray.http.HttpHeader, Option[Unit]]).isDefinedAt)
, .
implicit class Matches[T](x: T){
def matches(pf: PartialFunction[T, Any]) = pf isDefinedAt x
}
val filtered2 = headers filterNot (_ matches {case Authorization(_) =>})
List(Some(1), None) filterNot (_ matches {case None =>}) // List(Some(1))
, case statement PartialFunction s, .
List((5, 2, 'a'), (3, 4, 'b'), (3, 2, 'c')) filterNot (_ matches {case (3, _, x) if x == 'c' =>})
matches Scala , , matches , OP , .