-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
Prevent accidental Cthulhu summons #1760
Conversation
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.
ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn
cthulhu (First fp') = _ | ||
cthulhu (Second fp') = _ | ||
cthulhu (Alongside fp' fp_rca'b') = _ | ||
cthulhu (Fanout fp' fp_rcab') = _ |
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 means if we have a constructor like R'lyeh :: FreePro r c x y -> FreePro r c (Either a x) (Either b y) -> FreePro r c a b
(or more complex second argument) then we can still summon one, right?
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.
The _<blah>
bit only shows up if all of your type arguments are variables, which prevents arbitrarily long terms. I think we're still safe.
This PR makes Wingman pick more idiomatic identifiers when generating new variables.
Before, the situation was quite bad for complicated types:
But now, Wingman uses a bunch of rules to find acceptable names. It categorizes variables by their purpose, correlating roughly with intended semantic meaning. Right now, that means we can find things like monadic actions, functions, and predicates. For each purpose, we give a preferred ordering of variable names, and Wingman uses the first one that is available.
For long type constructors, Wingman will attempt to split them by camel case, turning eg
HelloWorld
intohw
. if that fails, it uses the first syllable of the constructor.This is not yet a perfect solution to naming, which should constrain names based on the relationship. But it's a significant step forward.