|
RE: Warnings on record updates: msg#00032lang.haskell.glasgow.bugs
You're right. GHC's pattern-match warnings are sometimes bogus -- fixing it is a long-standing wish-list item. However, here it looks as if the record pattern match is the cause of the problem, and I don't think I knew about that. So I've added your example to the current SourceForge bug report, which will mean that whoever fixes the problem will see your report too. Thanks for reporting it. Simon | -----Original Message----- | From: glasgow-haskell-bugs-bounces@xxxxxxxxxxx [mailto:glasgow-haskell-bugs- | bounces@xxxxxxxxxxx] On Behalf Of Peter White | Sent: 10 December 2004 19:14 | To: glasgow-haskell-bugs@xxxxxxxxxxx | Subject: Warnings on record updates | | When I compile the following module with the -Wall option on ghc v6.2.1 | I get warnings: | Warning: Pattern match(es) are non-exhaustive | In a record-update construct: Patterns not matched D2. | The warnings occur at both of the indicated places in the module. | Since the functions both handle all the cases of the data type D, it | seems the warning should not be given. | | ------------------------------------------------------------------------ | --------- | | module Try where | | data D = D1 { f1 :: Int } | D2 | | -- Use pattern matching in the argument | f :: D -> D | f d1@(D1 {f1 = n}) = d1 { f1 = f1 d1 + 1 } -- Warning here | f d = d | | -- Use case pattern matching | g :: D -> D | g d1 = case d1 of | D1 { f1 = n } -> d1 { f1 = n + 1 } -- Warning here also | D2 -> d1 | | Cheers | | Peter White | 503 466 0687 (Home) | 503 380 8024 (Cell) | | _______________________________________________ | Glasgow-haskell-bugs mailing list | Glasgow-haskell-bugs@xxxxxxxxxxx | http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | [ ghc-Bugs-1075259 ] Wrong overlapped/missing pattern warnings, SourceForge.net |
|---|---|
| Next by Date: | [ ghc-Bugs-1064881 ] internal error: stg_ap_pp_ret, SourceForge.net |
| Previous by Thread: | Warnings on record updates, Peter White |
| Next by Thread: | [ ghc-Bugs-1064881 ] internal error: stg_ap_pp_ret, SourceForge.net |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |