-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't fold lets if the let-bound variable occurs under a lambda-abstr…
- Loading branch information
Showing
10 changed files
with
113 additions
and
60 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
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
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
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
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
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
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,2 @@ | ||
nothing | ||
just 1 |
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 @@ | ||
0 |
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 |
---|---|---|
@@ -1,15 +1,15 @@ | ||
-- builtin list | ||
module test059; | ||
|
||
import Stdlib.Prelude open hiding {head}; | ||
import Stdlib.Prelude open; | ||
|
||
mylist : List Nat := [1; 2; 3 + 1]; | ||
|
||
mylist2 : List (List Nat) := [[10]; [2]; 3 + 1 :: nil]; | ||
|
||
head : {a : Type} -> a -> List a -> a | ||
head' : {a : Type} -> a -> List a -> a | ||
| a [] := a | ||
| a [x; _] := x | ||
| _ (h :: _) := h; | ||
|
||
main : Nat := head 50 mylist + head 50 (head [] mylist2); | ||
main : Nat := head' 50 mylist + head' 50 (head' [] mylist2); |
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,18 @@ | ||
-- Non-duplication in let-folding | ||
module test081; | ||
|
||
import Stdlib.Prelude open; | ||
|
||
{-# inline: false #-} | ||
g (h : Nat -> Nat) : Nat := h 0 * h 0; | ||
|
||
terminating | ||
f (n : Nat) : Nat := | ||
if | ||
| n == 0 := 0 | ||
| else := | ||
let terminating x := f (sub n 1) | ||
in | ||
g \{_ := x}; | ||
|
||
main : Nat := f 10000; |