github finagle/finch 0.7.0
Finch 0.7.0

latest releases: v0.34.1, v0.34.0, v0.33.0...
9 years ago

This release is mostly a result of @travisbrown's heroic efforts on replacing ugly hacks (eg. types / and ~) with Shapeless' primitives. As a result, a bunch of API has been marked deprecated.

Some inspiring statistics:

  • 17 contributors pushed 136 commits since 0.6.0, which is a new record
  • 3 new adopters since 0.6.0, which is a new record

Breaking API Changes

  • the / type (case class) is removed in favour of HList (see details below)

Deprecated API

  • finch-json is completely deprecated (and will be removed in 0.8.0) in favour finch-argonaut
  • finch-jawn is deprecated (and will be removed in 0.8.0) in favour other JSON libraries
  • both ~ type (case class) and ~ RequestReaders compositor are deprecated in favour of HList-based readers (see details below)
  • finch-micro is deprecated (and will be removed in 0.8.0) in favour of coproduct routers (see details below)

New Packages

  • finch-json4s - JSON4S support in Finch (contributed by @imliar)

New Infrastructure

Finch is moving towards better stability and performance by integrating well-known tools: ScalaCheck and JMH. Property-based testing helped us to completely cover the JSON packages (and some API fromfinch-core) with tests. Benchmarking allowed us to establish the initial performance characteristic of the major Finch components.

New Features

Most of the new features have landed in the finch-core package.

HList-powered RequestReader

The :: compositor is now used instead of ~ in the applicative syntax of RequestReader. The main different is that :: constructs a RequestReader[A :: B :: HNil] instead of RequestReader[A ~ B]. The main advantage of this migration is that a well-known method as is now can be used more generically, allowing to convert any underlying HList into a case class.

case class Foo(i: Int, s: String)
val foo: RequestReader[Foo] =
  (param("i").as[Int] :: param("s")).as[Foo]

See section "Applicative Syntax" for more details.

HList-powered Router

The / case class has been replaced with HList. This change shouldn't affect end users, except for the cases when / extractor is used. See section "Composing Routers" for more details.

Coproduct Routers

This is another attempt (as well as finch-micro) to solve the problem of programming with types that matter. The basic idea behind this is that it's now possible to compose two routers of different types using the :+: compositor that constructs a Router[C <: Coproduct].

val router: Router[Foo :+: Bar :+: CNil] =
  (foo: Router[Foo]) :+: (bar: Router[Bar])

The killer feature of coproduct routers is that they can be safely converted into a Finagle services using the toService method.

val router: Router[String :+: HttpResponse :+: CNil] = ???
val service: Service[HttpRequest, HttpResonse] = router.toService

See section "Coproduct Routers" for more details.

Don't miss a new finch release

NewReleases is sending notifications on new releases.