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 support for the Newtype library #56

Closed
gvolpe opened this issue Dec 14, 2019 · 6 comments · Fixed by #209
Closed

Add support for the Newtype library #56

gvolpe opened this issue Dec 14, 2019 · 6 comments · Fixed by #209
Assignees
Labels
enhancement New feature or request

Comments

@gvolpe
Copy link
Contributor

gvolpe commented Dec 14, 2019

It seems the @newtype annotation from the scala-newtype library doesn't work well with the @derive annotation.

This fails to compile:

@newtype
@derive(show)
case class Foo(value: String)

@newtype
@derive(show)
case class Bar(value: Int)

@derive(show)
final case class Ctx(foo: Foo, bar: Bar)

Here's the error:

[error] /examples/foo.scala:19:4: magnolia: could not find Show.Typeclass for type examples..Foo
[error]     in parameter 'foo' of product type examples.Ctx
[error]   @derive(show)
[error]    ^
[error] one error found
[error] (Compile / compileIncremental) Compilation failed

Maybe worth looking into scalaz-deriving that has support for it.

@REDNBLACK
Copy link
Contributor

I’m currently in progress of making them (derevo + newtype) to work together nicely. Soon (tm)

@gvolpe
Copy link
Contributor Author

gvolpe commented Dec 14, 2019

Awesome! Thanks for your blazing fast response 😄

Should I close this issue or you want me to leave it open until this happens? :)

@gvolpe
Copy link
Contributor Author

gvolpe commented Dec 14, 2019

FWIW derevo will be featured in Chapter 10 of my book https://leanpub.com/pfp-scala 🤓

@REDNBLACK
Copy link
Contributor

REDNBLACK commented Dec 14, 2019

Leave it open. btw, nice book, bought it as soon as it came :)

@gvolpe
Copy link
Contributor Author

gvolpe commented Dec 14, 2019

Glad to hear, thanks! :)

@gvolpe gvolpe changed the title Add support the Newtype library Add support for the Newtype library Dec 17, 2019
@REDNBLACK REDNBLACK self-assigned this Jan 1, 2020
@REDNBLACK REDNBLACK added the enhancement New feature or request label Jan 1, 2020
@rabzu
Copy link

rabzu commented Mar 25, 2020

Hi, any news on this?

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

Successfully merging a pull request may close this issue.

4 participants