-
Notifications
You must be signed in to change notification settings - Fork 145
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
2 changed files
with
31 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- See 'https://github.com/Frege/frege/issues/271 Issue #271' | ||
--- - Compiler issues a guard-may-fail warning, despite default case available. | ||
--- - Should print Nothing, but dies of tuple pattern not matched | ||
|
||
--- Turns out that the pattern binding in the first clause of 'readDriveShare' morphs to | ||
--- > readDriveShare (x:xs) = let u = (['f', 'g']) in | ||
--- > case u of (a,_) -> case u of (_,b) | x == '/' = Just (x:a,b) | ||
--- and this wrongly attaches the guard to the wrong case clause. | ||
|
||
--- Solution: drop the special handling of | ||
--- > let a = case ... in ... | ||
--- It didn't play well with laziness anyway. | ||
|
||
module tests.comp.Issue271 where | ||
|
||
|
||
readDriveShare (x:xs) | x == '/' = b | ||
where | ||
(a,b) = (['f'], undefined) | ||
-- a = case (['f'],['g']) of (a,_) = a | ||
-- b = case (['f'],['g']) of (_,b) = b | ||
|
||
readDriveShare _ = "" | ||
|
||
main = print $ readDriveShare (toList "file") | ||
|
||
simpler (s:ss) | s == "foo" = (b,a) where (a,b) = (42,true) | ||
simpler _ = (false, 0) |