|
Warnings on record updates: msg#00027lang.haskell.glasgow.bugs
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)
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Bug in specialise, Ross Paterson |
|---|---|
| Next by Date: | [ ghc-Bugs-1064881 ] internal error: stg_ap_pp_ret, SourceForge.net |
| Previous by Thread: | [ ghc-Bugs-1073501 ] checkProddableBlock: invalid fixup in runtime linker, SourceForge.net |
| Next by Thread: | RE: Warnings on record updates, Simon Peyton-Jones |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |