http4s/http4s — pull request #55 by rossabaker (2014-09-08 06:11:24+00:00)
Title: Change HttpService to a (Request => Task[Response]) wrapper

As bikeshedded in #53, PartialFunctions are not nice. This builds on @bryce-anderson 's Task-optionalized-by-Pass-failure concept.

The `Pass` hack is hidden on combinators in the new `Service` type, except for `PushSupport`. I am still unable to think of another middleware that would care about `Pass` without building on `Service`. I will get behind this in place of `OptionT` as long direct references `Pass` references remain exceedingly rare.

Regarding `Service`, `Kleisli` doesn't work because it is not tailored to optionality, and `NullResult` doesn't work because it doesn't know about our representation of optionality. `Service` serves the needs of our (ab)use of Task.

* A `Service` is built from a partial function via the apply method. This gives a nice, DSL feel.
* A Service is constructed from a total function through the `service` method. Wart: We have no way to prevent a partial function here.
* The HttpService.`httpService` and HttpService.`apply` methods are questionable, and exist only to save on import tax.
* `Service` is not a value class so `HttpServiceSyntax` could be a value class. This relationship may be revisited.