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

Macro to derive ordering for case class #1054

Closed
johnynek opened this issue Sep 16, 2014 · 8 comments
Closed

Macro to derive ordering for case class #1054

johnynek opened this issue Sep 16, 2014 · 8 comments

Comments

@johnynek
Copy link
Collaborator

@jcoveney

What we want is this:

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

object MyClass {
def ordering = deriveOrdering[MyClass]
def monoid = deriveMonoid[MyClass]
}

@jcoveney
Copy link
Contributor

Ordering is extremely easy. I'll put that in a patch the bijection
(assuming we get the other in nudge nudge)

What semantics do we want the monoid one to have? To be identical to the
rest ie treat it like a Tuple? Should be trivial as well. But I'm not sure
how to deal with the deps. It would ideally use some of the code I've
developed in the bijection code... It's not a ton so I could copy it. But
that feels lame. Thoughts on how we wanna manage deps for this stuff?

@avibryant
Copy link
Contributor

What's wrong with depending on bijection? To start with just use the bijection to tuple, the tuple monoid, then back again. (In fact is there not an implicit bijection monoid that does this already?)

@jcoveney
Copy link
Contributor

There is no bijection from any case class to tuple, but you're right, with
the bijection I am working on in bijection it should just work

@jcoveney
Copy link
Contributor

Actually with the bijection code I think I can make a converter for any
type class!! Keep your eyes peeled tomorrow...

@jcoveney
Copy link
Contributor

twitter/bijection#179 + twitter/bijection#183 provide a very nice way to get these for free.

@Trevoke
Copy link

Trevoke commented Oct 4, 2016

@jcoveney Is it tomorrow yet?

@johnynek
Copy link
Collaborator Author

johnynek commented Oct 4, 2016

@johnynek johnynek closed this as completed Oct 4, 2016
@Trevoke
Copy link

Trevoke commented Oct 4, 2016

Thanks :)

On Tue, Oct 4, 2016 at 1:51 PM P. Oscar Boykin [email protected]
wrote:

Closed #1054 #1054.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#1054 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAEJSYiBQO4-HXYQOZv2VuYaqARsgPAlks5qwpI7gaJpZM4CiwrD
.

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