-
Notifications
You must be signed in to change notification settings - Fork 414
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
inductive Foo where | ||
| foo : (String → Option Foo) → Foo | ||
|
||
-- Would be great if this worked, but it doesn't yet: | ||
|
||
/-- | ||
error: failed to infer structural recursion: | ||
Cannot use parameter #2: | ||
failed to eliminate recursive application | ||
map m x | ||
-/ | ||
#guard_msgs in | ||
def Foo.map (m : Foo → Foo) : Foo → Foo | ||
| .foo f => .foo fun s => match f s with | ||
| none => none | ||
| some x => map m x | ||
termination_by structural x => x | ||
|
||
-- workaround: | ||
|
||
mutual | ||
def Foo.bar (m : Foo → Foo) : Foo → Foo | ||
| .foo f => .foo fun s => Foo.bar_aux m (f s) | ||
termination_by structural x => x | ||
|
||
def Foo.bar_aux (m : Foo → Foo) : Option Foo → Option Foo | ||
| none => none | ||
| some x => bar m x | ||
termination_by structural x => x | ||
end |