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

Case expressions at the root of a definition should contribute to termination #3060

Open
janmasrovira opened this issue Sep 25, 2024 · 0 comments
Labels
enhancement New feature or request termination
Milestone

Comments

@janmasrovira
Copy link
Collaborator

E.g. it should be possible to write

isMember {A} (testEq : A → A → Bool) (element : A) (list : List A) : Bool := case list of {
  | nil := false
  | x :: xs := testEq element x || isMember testEq element xs 
};

Moreover, we'd like to support simultaneously casing on multiple elements with the help of the Pair type (or any other product type) and still detect termination.

zipWith {A B C} (f : A -> B -> C) (list1 : List A) (list2 : List B) : List C := case list1, list2 of {
  | nil, _ := nil
  | _, nil := nil
  | x :: xs, y :: ys := f x y :: zipWith f xs ys
};
@lukaszcz lukaszcz added this to the 0.6.9 milestone Nov 15, 2024
@paulcadman paulcadman modified the milestones: 0.6.9, 0.6.11 Dec 2, 2024
@paulcadman paulcadman added enhancement New feature or request and removed enhancement New feature or request priority:medium pending-review labels Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request termination
Projects
None yet
Development

No branches or pull requests

3 participants