markhibberd/argonaut — pull request #45 by markhibberd (2013-04-30 08:23:33+00:00)
Title: Codecs

Fixes #18.
Fixes #41. (By exporting law on CodecJson)

After this commit there are some nice conveniences for
declaring Encode and Decode pairs.

For example:

case class Fred(name: String, age: Int)

// safe

val codec = codec2(Fred.apply, fred => (fred.name, fred.age))(name, age)

// or utilizing generated unapply (partial function, but not really for case classes)

val codec = casecodec2(Fred.apply, Fred.unapply)(name, age)