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

Magnolia derivation for Debug typeclass #1371

Merged
merged 2 commits into from
Sep 5, 2024

Conversation

cheleb
Copy link
Contributor

@cheleb cheleb commented Sep 4, 2024

closes #1076

@cheleb cheleb requested a review from a team as a code owner September 4, 2024 17:12
@cheleb cheleb force-pushed the derive-debug branch 2 times, most recently from 1f2cb8b to d9ae483 Compare September 4, 2024 17:13
Copy link
Member

@sideeffffect sideeffffect left a comment

Choose a reason for hiding this comment

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

This is lovely to see. Could you please adjust a few things so that we can merge this?

"com.softwaremill.magnolia1_3" %% "magnolia" % "1.3.7"
case _ =>
"com.softwaremill.magnolia1_2" %% "magnolia" % "1.1.10"
// libraryDependencies += compilerPlugin("org.typelevel" %% "kind-projector" % "0.13.3" cross CrossVersion.full)
Copy link
Member

Choose a reason for hiding this comment

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

commented code in build

@@ -0,0 +1,38 @@
package zio.debug.magnolia
Copy link
Member

Choose a reason for hiding this comment

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

The package name should be zio.prelude.magnolia.

Copy link
Member

Choose a reason for hiding this comment

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

What do you think about adding an extension method on the Debug companion object, so that it also contains the derived method, so that in Scala 3 we can do case class Child(name: String, age: Int) derives Debug?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whhhhhaou that exactly what I did not knew how to do !
Thx, will do it tonight.

Copy link
Contributor Author

@cheleb cheleb Sep 5, 2024

Choose a reason for hiding this comment

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

Hum, I suppose then that I should merge magnolia and core module, right ?
Or AFAIU I run in cyclic dependencies.

Copy link
Member

Choose a reason for hiding this comment

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

cyclic dependencies

Nope. Have zio-prelude-magnolia depend on zio-prelude. zio-prelude must not know about Magnolia or ``zio-prelude-magnolia`.

That's why we'll make it an extension method of the Debug companion object. Not an actual method on Debug companion object.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

:-/
Just pushed the simplest fix.
No idea how to add an extension to an existing companion object.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok @sideeffffect I found :S

Copy link
Member

@sideeffffect sideeffffect left a comment

Choose a reason for hiding this comment

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

Awesome, thank you so much again! 🎉

@sideeffffect sideeffffect merged commit 9df9ecb into zio:series/2.x Sep 5, 2024
20 checks passed
@sideeffffect
Copy link
Member

@cheleb
Copy link
Contributor Author

cheleb commented Sep 5, 2024 via email

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