warnings for pattern matches generated by the compiler
Simon Peyton-Jones
simonpj at microsoft.com
Mon Mar 11 12:48:44 EST 2002
GHC's pattern-match overlap checker is a regular source of (justified)
complaints. Somehow it never gets to the top of our agenda.
It's a well-identified piece of the compiler if anyone feels motivated
to lend a hand. Otherwise I can't promise when we'll get to it.
But keep prodding us at intervals if it is important to you. Maybe
one of us will have a rush of blood to the head.
Simon
| -----Original Message-----
| From: Feliks Kluzniak [mailto:feliks at crt.se]
| Sent: 09 March 2002 12:33
| To: glasgow-haskell-bugs at haskell.org
| Subject: warnings for pattern matches generated by the compiler
|
|
|
| Hello!
|
| I like to have the warnings about non-exhaustive pattern
| matches etc. turned on: I find them very useful.
| Unfortunately, this prevents me from taking full advantage of
| field labels.
|
| Here is an (artificial) example:
|
| module See ( D, foo ) where
|
| data D = U | D{ value :: Int }
|
| foo :: D -> D
|
| foo d = case d
| of
| D{} -> d{ value = value d + 1 }
| U -> D{ value = 0 }
|
| GHC complains as follows:
|
| ghc --make -odir../ghc -hidir../ghc -Wall
| -fno-warn-missing-signatures See.hs
| ghc-5.02.2: chasing modules from: See.hs
| Compiling See ( See.hs, ../ghc/See.o )
|
| See.hs:9: Warning: Pattern match(es) are non-exhaustive
| In a record-update construct (D ds_dpd): Patterns not
| matched: U
|
| This is not quite as it should be, is it?
|
| Is there any work-around other than abandoning the use of
| field labels or turning off the warnings? (In my real
| application there are quite a few more cases in the union,
| and more fields.)
|
| Regards,
| -- Feliks
| _______________________________________________
| Glasgow-haskell-bugs mailing list
| Glasgow-haskell-bugs at haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-| haskell-bugs
|
More information about the Glasgow-haskell-bugs
mailing list