-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parse where clause into the corresponding let (fix #209)
- Loading branch information
1 parent
a04e531
commit 1a688e3
Showing
4 changed files
with
52 additions
and
13 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,25 @@ | ||
-- Test that the where clause parses and evaluates. | ||
-- Three places you can see where: | ||
-- - top-level function definition | ||
-- - let binding | ||
-- - case alternative | ||
|
||
module ParseWhere where | ||
|
||
data MyBool = B Bool | ||
|
||
f x = y + case B True of | ||
B _ -> z | ||
where z = 0 | ||
where | ||
y = x+1 | ||
|
||
g x = let | ||
y = z | ||
where z = -1 | ||
in x + y | ||
|
||
gibbon_main = f 1 + g 1 | ||
|
||
main :: IO () | ||
main = print gibbon_main |
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 |
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