Proposal: Add Encoder and Decoder
Something like:
trait Encoder[T, U] {
def apply(t: T): U
// and andThen, toFn,
}
trait Decoder[U, T] {
def apply(u: U): Try[T]
}
// composition might be clearer than inheritance here.
trait Injection[T, U] {
def encoder: Encoder[T, U]
def decoder: Decoder[U, T]
}
trait Bijection[T, U] {
def encoder: Encoder[T, U]
def inverseEncoder: Encoder[U, T]
}
+1
On Monday, January 27, 2014, P. Oscar Boykin [email protected] wrote:
Something like:
trait Encoder[T, U] { def apply(t: T): U // and andThen, toFn, } trait Decoder[U, T] { def apply(u: U): Try[T]} // composition might be clearer than inheritance here.trait Injection[T, U] { def encoder: Encoder[T, U] def decoder: Decoder[U, T]} trait Bijection[T, U] { def encoder: Encoder[T, U] def inverseEncoder: Encoder[U, T]}
— Reply to this email directly or view it on GitHubhttps://github.com/twitter/bijection/issues/158 .
It all comes back again :)
ianoc mailto:[email protected] January 27, 2014 2:08 PM +1
On Monday, January 27, 2014, P. Oscar Boykin [email protected] wrote:
Something like:
trait Encoder[T, U] { def apply(t: T): U // and andThen, toFn, } trait Decoder[U, T] { def apply(u: U): Try[T]} // composition might be clearer than inheritance here.trait Injection[T, U] { def encoder: Encoder[T, U] def decoder: Decoder[U, T]} trait Bijection[T, U] { def encoder: Encoder[T, U] def inverseEncoder: Encoder[U, T]}
— Reply to this email directly or view it on GitHubhttps://github.com/twitter/bijection/issues/158 .
— Reply to this email directly or view it on GitHub https://github.com/twitter/bijection/issues/158#issuecomment-33422938.
P. Oscar Boykin mailto:[email protected] January 27, 2014 11:25 AM
Something like:
trait Encoder[T, U] { def apply(t: T): U // and andThen, toFn, }
trait Decoder[U, T] { def apply(u: U): Try[T] }
// composition might be clearer than inheritance here. trait Injection[T, U] { def encoder: Encoder[T, U] def decoder: Decoder[U, T] }
trait Bijection[T, U] { def encoder: Encoder[T, U] def inverseEncoder: Encoder[U, T] }
— Reply to this email directly or view it on GitHub https://github.com/twitter/bijection/issues/158.
Sam Ritchie (@sritchie) Paddleguru Co-Founder 703.863.8561 www.paddleguru.com http://www.paddleguru.com/ Twitter http://twitter.com/paddleguru// Facebook http://facebook.com/paddleguru
@sritchie yep…. twitter.bijection looks like an worse and worse package name. :)
Tony boy had it right all along!!
@softprops liked Kodiak
Thanks @sritchie .I mentioned "Codiak" on the twttrs: think Kodiak the bear but with a C for codec ( for transformations to and fro ). I had a similar idea for a library like bijection a few years back with Codiak as name because I realized there were so many interfaces for client libraries that could be implemented in terms of something like what you guys did actually did a good job of flushing out :) Free free to take this name. I never did anything with that repo as you can probably tell. It may go against twttrs bird rule for names though :). Anyway, feel free to take this name if it make sense.