-
Notifications
You must be signed in to change notification settings - Fork 139
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
Simplify representation of measure names #2464
Conversation
getLHNameResolved n@LHNUnresolved{} = error $ "getLHNameResolved: unresolved name: " ++ show n | ||
getLHNameResolved n@LHNUnresolved{} = error $ "getLHNameResolved: unresolved name: " ++ showLHNameDebug n | ||
|
||
showLHNameDebug :: LHName -> String |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be the Show
instance really, and what is now the instance should be a regular function that explains what it is for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried that, and found that it influenced error messages intended for users. I'll address this in a follow up PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That cleans up nicely!
sp1 | ||
return (sp2, logicNameEnv0) | ||
else | ||
return (error "invalid spec", error "invalid logic environment") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a module name or function name to the error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm counting on the error trace to show me the location. But I added the function name anyway in 919776d.
c8f9a2a
to
919776d
Compare
Thanks for the review @sjoerdvisscher! |
This PR changes the name field of measures to use LHName instead of Symbol. This makes possible to store more information in the name field, instead of paring the
Measure
records with LHName in specs.I considered generalizing the type of the field instead of hard-coding it to LHName, but the new type parameter would have propagated to specs and it was a lot of changes and an extra parameter for no clear benefit.
Another commit provides a show function for LHNames that prints the structure of the name. And yet another commit fixes a problem where name resolution would panic if early stages produced an error and we allowed the resolution to proceed anyway, now we interrupt name resolution early if there are errors.