We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi, as far as I can tell, using newtypes together with phantom types isn't supported at the moment, i.e. essentially
case class Identifier[T](value: String)
but as a newtype instead of as a case class.
The straightforward thing to try would be
type Identifier[T] = Identifier.Type object Identifier extends NewtypeWrapped[String]
However, this doesn't provide any type safety, since for any A and B, Identifier[A] and Identifier[B] are the same type.
A
B
Identifier[A]
Identifier[B]
I'm not sure what the right design here would be, but I think it would be useful to have - assuming I'm not missing an existing way to do it.
Cheers!
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi, as far as I can tell, using newtypes together with phantom types isn't supported at the moment, i.e. essentially
but as a newtype instead of as a case class.
The straightforward thing to try would be
However, this doesn't provide any type safety, since for any
A
andB
,Identifier[A]
andIdentifier[B]
are the same type.I'm not sure what the right design here would be, but I think it would be useful to have - assuming I'm not missing an existing way to do it.
Cheers!
The text was updated successfully, but these errors were encountered: