unused record fields

Serge D. Mechveliani mechvel at botik.ru
Fri Oct 15 13:04:20 EDT 2010

Simon P. Jones  wrote recently about that  ghc-6.12  takes in 
account the elliplis in  MkT {t1 = x, ..}  when reporting about 
unused bindings.

Now, here is the example: 

  module TT where
  data T = T {t1, t2 :: Int}

  f d = x  where
           T {t1 = x, ..} = d

ghc-6.12.2  warns about unused value of  t2.
And for                        f (T {t1 = x, ..}) = x,  
it does not warn about this.

Is this a bug?

I use
extensions: TypeSynonymInstances UndecidableInstances FlexibleContexts 
            FlexibleInstances MultiParamTypeClasses OverlappingInstances
            RecordWildCards NamedFieldPuns
ghc-options: -fno-warn-overlapping-patterns -fwarn-unused-binds 
             -fwarn-unused-matches -fwarn-unused-imports 
but the options can be simplified, of course.

Serge Mechveliani
mechvel at botik.ru

More information about the Glasgow-haskell-users mailing list