spray/spray — pull request #898 by 4lex1v (2014-07-01 16:12:04+00:00)
Title: + routing: small addition to Marshaller(M) typeclass syntax

Hello! I know that you guys are busy on the integration with akka, so i wanted just to propose slight addition to marshallers. I was refactoring our module on Spray/Scalaz integration and thought that this addition would slightly improve the "typeclass" syntax of marshallers, similar to what Scalaz has, i.e `Monad[Option].point("Hello!")`. This can be useful when you want to make new marshaller over the old one, e.g marshaller for new `Maybe` type can be made with option marshaller, currently it looks like:

```scala
implicit def marshaller[A: Marshaller]: Marshaller[Maybe[A]] = Marshaller[Maybe[A]] {
(value, ctx) => MetaMarshallers.optionMarshaller[A].apply(value.toOption, ctx)
}
```

Of cause `MetaMarshallers.optionMarshaller[A]` can be replaced with `implicitly[Marshaller[Option[A]]`, but it's a bit longer then new version and we have to explicitly call `apply`. So, in order to make it look'n'feel more like a typeclass, i've made this to additions: added `apply` method on the companions (to remove explicit `implicitly` call) and an alias to `apply` on the `Marshaller(M)` trait itself. It looks to me that this way it's more elegant to make such stuff:

```scala
implicit def marshaller[A: Marshaller]: Marshaller[Maybe[A]] = Marshaller[Maybe[A]] {
(value, ctx) => Marshaller[Option[A]].marshal(value.toOption, ctx)
}
```

The same way i did for MarshallerM. My personal use case are marshallers for monadic transformers (but not only for them):

```scala
implicit def maybeTMarshaller[M[_]: MarshallerM, A: Marshaller]: Marshaller[MaybeT[M, A]] =
Marshaller[MaybeT[M, A]] { (value, ctx) => MarshallerM[M].marshal[Maybe[A]](value.run, ctx) }
```

And also now there is no need to write arg list for implicit parameters, if someone prefers this way over `implicitly[..]`. Wo do you think on this?