estatico / scala-newtype

NewTypes for Scala with no runtime overhead
Apache License 2.0
540 stars 31 forks source link

Make newtypes abstract #7

Closed joroKr21 closed 6 years ago

joroKr21 commented 6 years ago

This prevents scalac from dealiasing thus improving type inference. Especially important when using type lambdas.

Also add ClassTag implicits to ensure Arrays keep working.

joroKr21 commented 6 years ago

Oh no, I think I forgot about Scala 2.10 again...

carymrobbins commented 6 years ago

@joroKr21 Nice! I actually have an abstract-type branch in which I was working to fix this. Since Scala 2.10 objects don't support abstract type members, I was able to get around it by defining them in a trait and having the companion extend the trait.

joroKr21 commented 6 years ago

Neat :+1: I did not know that you can inherit the abstract type without defining it in Scala 2.10

carymrobbins commented 6 years ago

Me either! Well, until I just experimented around and discovered it ;)

Thanks again for your help @joroKr21!