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

Fixups for joroKr21's abstract-types PR #1

Closed

Conversation

carymrobbins
Copy link

Brings together both of our changes for resolving refs estatico#8 which also includes my introduction of cats-tests

Brings together both of our changes for resolving refs #8
which also includes my introduction of cats-tests
@carymrobbins
Copy link
Author

@joroKr21 If you merge these changes into your branch, I'll go ahead and merge your branch upstream and cut a 0.3.0 release. Thanks for your help!

@carymrobbins
Copy link
Author

Also note that I've removed the <: usage in BaseNewType. That's a legacy encoding and I think it's less important for that to be there. It seems to not work well when using NewTypeOps, specifically complains about type invariance with NewTypeAutoOps#toNewTypeOps -

[error] scala-newtype/shared/src/main/scala/io/estatico/newtype/NewType.scala:17: type mismatch;
[error]  found   : x.type (with underlying type NewTypeAutoOps.this.Type)
[error]  required: io.estatico.newtype.BaseNewType.Aux[NewTypeAutoOps.this.Type,NewTypeAutoOps.this.Tag,NewTypeAutoOps.this.Repr]
[error]     (which expands to)  io.estatico.newtype.BaseNewType.Aux[io.estatico.newtype.BaseNewType.Aux[NewTypeAutoOps.this.Base,NewTypeAutoOps.this.Tag,NewTypeAutoOps.this.Repr],NewTypeAutoOps.this.Tag,NewTypeAutoOps.this.Repr]
[error] Note: NewTypeAutoOps.this.Base >: NewTypeAutoOps.this.Type, but type Aux is invariant in type B.
[error] You may wish to define B as -B instead. (SLS 4.5)
[error]   ): NewTypeOps[Type, Tag, Repr] = new NewTypeOps[Type, Tag, Repr](x)
[error]                                                                    ^

I assume that since we've introduced the @newtype macro, the need to rely on the legacy encoding will be less and less as time marches on.

@carymrobbins
Copy link
Author

Actually, I think I can just change the base of your PR to my branch, that way we can retain the history a bit better (especially since I'm introducing cats-tests).

@carymrobbins carymrobbins deleted the joroKr21-abstract-types branch February 27, 2018 18:28
@carymrobbins
Copy link
Author

Also note that I've removed the <: usage in BaseNewType. That's a legacy encoding and I think it's less important for that to be there. It seems to not work well when using NewTypeOps, specifically complains about type invariance with NewTypeAutoOps#toNewTypeOps -

Actually, that may have been before I introduced your additional fix which corrected the type params applied in NewTypeAutoOps. You can see the final solution in my estatico#9 PR, which just applies the same "have object inherit from a trait" trick.

https://github.com/estatico/scala-newtype/pull/9/files#diff-0cc28c2b4e8123ead5d9bf361f2ae32bL23

joroKr21 pushed a commit that referenced this pull request Apr 19, 2018
Improve generic example in README
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.

1 participant