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

Add auto-derivation #27

Merged
merged 8 commits into from
Jul 17, 2023
Merged

Add auto-derivation #27

merged 8 commits into from
Jul 17, 2023

Conversation

ghostbuster91
Copy link
Collaborator

@ghostbuster91 ghostbuster91 commented Mar 5, 2023

The goal of this PR is to add support for auto-derivation in difficious.

@ghostbuster91 ghostbuster91 force-pushed the auto-derivation branch 2 times, most recently from 515e5e5 to bdd4305 Compare March 5, 2023 23:04
@@ -0,0 +1,3 @@
package difflicious

case class Derived[T](differ: Differ[T])
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be also implemented as in circe - Derived[T](instance: T), this way it could support multiple typeclasses but it is not necessary in our case. Not sure if there are any other pros and cons.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine though I wonder whether something like

trait DerivedDiffer[T] extends Differ[T] {
  def underlying: Differ[T]
}

Will be more ergonomic. Will try it out later

@ghostbuster91 ghostbuster91 force-pushed the auto-derivation branch 3 times, most recently from 9c6d22d to e3ed246 Compare March 5, 2023 23:10
@ghostbuster91
Copy link
Collaborator Author

@jatcwang before I move any further with this PR, could you provide some feedback? Is this the approach that you have in mind?

@jatcwang
Copy link
Owner

Thanks for this. Feel free to merge this into core module instead of a separate module :)

@jatcwang jatcwang self-assigned this Jul 11, 2023

for scala 3
```scala
import difflicious.generic.auto.given
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ghostbuster91 You had import difflicious.generic.auto._ here before too but I think it's not needed? I removed it from the docs and tests. Let me know if it needs to be for any reason

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah indeed, it was redundant, good catch!

@jatcwang
Copy link
Owner

Thank you!

@jatcwang jatcwang merged commit dd40247 into master Jul 17, 2023
@ghostbuster91 ghostbuster91 deleted the auto-derivation branch July 18, 2023 07:58
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

Successfully merging this pull request may close these issues.

2 participants