-
Notifications
You must be signed in to change notification settings - Fork 45
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
Fake constraint for newtypes with no underlying validation #122
Comments
opaque type FirstName = String :| True
object FirstName extends RefinedTypeOps[FirstName] val firstName = FirstName("Il_totore") //This is not my real first name
I don't really see the difference with |
@Iltotore The naming is not precise, though. It doesn't reflect the notion of "let use me if you just want to create a lightweight wrapper to have neat domain model and don't need validation at all"
The emphasis here is unlocking easy creation for runtime values. Please take a look at the example above. And with
The option is the usage of As a summary, the intention is to have DSL for anybody who wants a synonym to
|
This issue was an additional restriction which is probably not needed anymore. Fixing it should remove the need to create a I will be busy for the next weeks but will look at it ASAP. |
See #125 |
RefinedTypeOps
and accessing inner values of opaque types (withvalue
call) make iron very good in domain modeling.One potentially missing part is usage without actual validation (to simply separate value types).
I suggest introducing a fake constraint with easy runtime construction.
Not sure about the naming. I like
Pure
orNewtype
Ex.
And runtime is safe and straightforward.
What is important is if the user refactors type to
String :| ValidUUID
thenpure
stops compiling and requires updates.The text was updated successfully, but these errors were encountered: