-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add syntax sugar for nested sigma-types #183
Conversation
The sigma type part seems to work, tested with the following:
Not sure how to proceed with patterns, as adding syntax rules would either break existing stuff or warrant changes to semantic highlighting(I might be misunderstanding how it works). |
What are we calling those by the way? Not sure if "nested sigma types" is quite correct |
@@ -78,6 +78,10 @@ ParamVarShapeDeprecated. ParamDecl ::= "{" "(" Pattern ":" Term ")" "|" Term "}" | |||
paramVarShapeDeprecated. ParamDecl ::= "{" Pattern ":" Term "|" Term "}" ; | |||
define paramVarShapeDeprecated pat cube tope = ParamVarShapeDeprecated pat cube tope ; | |||
|
|||
-- Parameter declaration for Sigma types | |||
SigmaParam. SigmaParam ::= Pattern ":" Term ; |
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.
Ideally, I would like to reuse Param
, but I think this should be a separate change, since Param
allows shapes and we do not support shape types yet (see #50).
Perhaps, Σ-tuples? |
Here's a sketch: d8302a5 |
Closes #140.
Implemented syntax sugar allowing Sigma-types to accept more than one parameter in the parentheses with
Rzk.TypeSigmaNested
.It will always desugar to left-associativity, i.e:
Σ (a : A , b : B) , C a b
desugars toΣ ( ( a , b) : Σ (a : A) , B) , C a b
Σ ( a : A , b : B , c : C) , D a b c
desugars roughly toΣ ((x , c) : Σ ((a , b) : Σ (a : A) , B) , C) , D (first x) (second x) c