-
Notifications
You must be signed in to change notification settings - Fork 1
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
Remove unsafe FromJSON Name
instance
#834
base: main
Are you sure you want to change the base?
Conversation
3785868
to
a313773
Compare
Per comments in chat, we're doing this now because a) we're about to change |
Because it used `deriving newtype`, this instance constructed names without any validation, similarly to `unsafeMkName`. While we don't currently have any name validation, we expect that we will soon move to a "smart constructor" approach, ripping out most uses of `unsafeMkName`. We don't then want `fromJSON @Name` to remain as a validation-skipping backdoor. An alternative would be to use our smart constructor (i.e. `safeMkName`) in a manual implementation of `fromJSON`. But given that the instance is unused (other than to define more unused instances for types which contain `Name`), we may as well just remove it. N.B. This instance has been around since our old prototype frontend, and may have been useful back then.
a313773
to
c93e316
Compare
Right, this got bigger than expected. HLS didn't report all the knock-on errors straight away, which made me think the scope was smaller. The second commit highlights the handful of places where it isn't obvious how to proceed. It might make sense to now remove even more Anyway, since this isn't urgent, I'm going to leave it here for now. Maybe @dhess will want to take it over as part of the move towards adding name validation, and/or maybe it should be discussed at our next developer meeting. |
No description provided.