Skip to content
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

Merge if -> ite renaming from stdlib #2869

Merged
merged 2 commits into from
Jul 2, 2024
Merged

Merge if -> ite renaming from stdlib #2869

merged 2 commits into from
Jul 2, 2024

Conversation

janmasrovira
Copy link
Collaborator

No description provided.

@janmasrovira janmasrovira merged commit 82e6b5f into main Jul 2, 2024
8 checks passed
@janmasrovira janmasrovira deleted the update-stdlib branch July 2, 2024 08:03
janmasrovira added a commit that referenced this pull request Jul 3, 2024
…2852)

- Syntax for #2804.
- ⚠️ Depends on #2869.

This pr introduces:
1. front-end support (parsing, printing, typechecking) for boolean side
conditions for branches of case expressions.
2. Now `if` is a reserved keyword.
3. Multiway `if` is allowed to have only the `else` branch. I've also
refactored the parser to be simpler.

Example:
```
 multiCaseBr : Nat :=
    case 1 of
      | zero
        | if 0 < 0 := 3
        | else := 4
      | suc (suc n)
        | if 0 < 0 := 3
        | else := n
      | suc n if 0 < 0 := 3;
```
The side if branches must satisfy the following.
1. There must be at least one `if` branch.
4. The `else` branch is optional. If present, it must be the last.

Future work:
1. Translate side if conditions to Core and extend the exhaustiveness
algorithm.
5. Add side if conditions to function clauses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants