Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Add Encoder and Decoder #158

Open
johnynek opened this issue Jan 27, 2014 · 6 comments
Open

Proposal: Add Encoder and Decoder #158

johnynek opened this issue Jan 27, 2014 · 6 comments

Comments

@johnynek
Copy link
Collaborator

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]
}
@ianoc
Copy link
Collaborator

ianoc commented Jan 27, 2014

+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//issues/158
.

@sritchie
Copy link
Collaborator

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//issues/158
.


Reply to this email directly or view it on GitHub
#158 (comment).

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
#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

@johnynek
Copy link
Collaborator Author

@sritchie yep…. twitter.bijection looks like an worse and worse package name. :)

@sritchie
Copy link
Collaborator

Tony boy had it right all along!!

@sritchie
Copy link
Collaborator

@softprops liked Kodiak

@softprops
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants