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
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to