un-used record wildcards

2010-10-13 Thread Serge D. Mechveliani
Dear GHC developers, 

I use the language extension of RecordWildcards, for example,
f (Foo {foo1 = n, foo2 = m, ..}) = ...
  
But the complier warns about un-used values of  foo3, foo4,
probably, due to the extension of
 Foo {foo1 = n, foo2 = m, foo3 = foo3, foo4 = foo4}.

In such cases, these warnings look as unneeded.
Is it possible to have an un-used binding warnings with exception for
wildcards in records? 
If not, then has it sense to introduce an option?

Regards,
-
Serge Mechveliani
mech...@botik.ru
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: un-used record wildcards

2010-10-13 Thread Antoine Latter
On Wed, Oct 13, 2010 at 1:02 PM, Serge D. Mechveliani  wrote:
> Dear GHC developers,
>
> I use the language extension of RecordWildcards, for example,
>                                f (Foo {foo1 = n, foo2 = m, ..}) = ...
>
> But the complier warns about un-used values of  foo3, foo4,
> probably, due to the extension of
>                     Foo {foo1 = n, foo2 = m, foo3 = foo3, foo4 = foo4}.
>
> In such cases, these warnings look as unneeded.
> Is it possible to have an un-used binding warnings with exception for
> wildcards in records?
> If not, then has it sense to introduce an option?
>

If you're not using foo3 and foo4, can you not put it the ellipsis?
that won't cover every case (such as where you're using foo3 but not
foo4).

Antoine
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: un-used record wildcards

2010-10-14 Thread Serge D. Mechveliani
On Wed, Oct 13, 2010 at 01:47:11PM -0500, Antoine Latter wrote:
> On Wed, Oct 13, 2010 at 1:02 PM, Serge D. Mechveliani  
> wrote:
> > Dear GHC developers,
> >
> > I use the language extension of RecordWildcards, for example,
> >                                f (Foo {foo1 = n, foo2 = m, ..}) = ...
> >
> > But the complier warns about un-used values of  foo3, foo4,
> > probably, due to the extension of
> >                     Foo {foo1 = n, foo2 = m, foo3 = foo3, foo4 = foo4}.
> >
> > In such cases, these warnings look as unneeded.
> > Is it possible to have an un-used binding warnings with exception for
> > wildcards in records?
> > If not, then has it sense to introduce an option?
> >
> 
> If you're not using foo3 and foo4, can you not put it the ellipsis?
> that won't cover every case (such as where you're using foo3 but not
> foo4).
> 
> Antoine
> 

Indeed, thank you. 
It occurs that under RecordWildcards the compiler allows to skip some 
record fields in a pattern.
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


RE: un-used record wildcards

2010-10-14 Thread Simon Peyton-Jones
Which version of GHC are you using?  GHC 6.12 does not complain about unused 
variables bound by "..".  Try this, which complains about y, but not g.

Simon

{-# LANGUAGE RecordWildCards #-}
module Test where

data T = MkT { f,g :: Int }

p (MkT { .. }) y = f


|  -Original Message-
|  From: glasgow-haskell-users-boun...@haskell.org 
[mailto:glasgow-haskell-users-
|  boun...@haskell.org] On Behalf Of Serge D. Mechveliani
|  Sent: 14 October 2010 11:01
|  To: Antoine Latter
|  Cc: glasgow-haskell-users@haskell.org
|  Subject: Re: un-used record wildcards
|  
|  On Wed, Oct 13, 2010 at 01:47:11PM -0500, Antoine Latter wrote:
|  > On Wed, Oct 13, 2010 at 1:02 PM, Serge D. Mechveliani 
|  wrote:
|  > > Dear GHC developers,
|  > >
|  > > I use the language extension of RecordWildcards, for example,
|  > >                                f (Foo {foo1 = n, foo2 = m, ..}) = ...
|  > >
|  > > But the complier warns about un-used values of  foo3, foo4,
|  > > probably, due to the extension of
|  > >                     Foo {foo1 = n, foo2 = m, foo3 = foo3, foo4 = foo4}.
|  > >
|  > > In such cases, these warnings look as unneeded.
|  > > Is it possible to have an un-used binding warnings with exception for
|  > > wildcards in records?
|  > > If not, then has it sense to introduce an option?
|  > >
|  >
|  > If you're not using foo3 and foo4, can you not put it the ellipsis?
|  > that won't cover every case (such as where you're using foo3 but not
|  > foo4).
|  >
|  > Antoine
|  >
|  
|  Indeed, thank you.
|  It occurs that under RecordWildcards the compiler allows to skip some
|  record fields in a pattern.
|  ___
|  Glasgow-haskell-users mailing list
|  Glasgow-haskell-users@haskell.org
|  http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: un-used record wildcards

2010-10-15 Thread Serge D. Mechveliani
Thank you.
This was with  ghc-6.12.2  and
  RecordWildCards 
  TypeSynonymInstances UndecidableInstances FlexibleContexts 
  FlexibleInstances MultiParamTypeClasses OverlappingInstances,

  -fwarn-unused-binds -fwarn-unused-matches -fwarn-unused-imports 
  -fno-warn-overlapping-patterns 
 
1) Then, I dropped `,..' in the places where I do not really need other
   fields, and it has improved.
2) Now, after reading your letter, I tried your example with MkT, and
   it is all right. Then, I returned `,..' to my code (still the precise 
   initial code is lost, too many changes done), and I cannot obtain now 
   these messages about unused binds.
Most probably, this was some other effect with the variables.
The program is complex, and I have lost the initial code due to 
`successfull' attempt with omitting elliplis. I also have to see how the 
result program will work, this is my first attempt with  RecordWildCards, 
and now, also with  NamedFieldPuns.

---
Mechveliani


On Thu, Oct 14, 2010 at 10:06:49PM +, Simon Peyton-Jones wrote:
> Which version of GHC are you using?  GHC 6.12 does not complain about unused 
> variables bound by "..".  Try this, which complains about y, but not g.
> 
> Simon
> 
> {-# LANGUAGE RecordWildCards #-}
> module Test where
> 
> data T = MkT { f,g :: Int }
> 
> p (MkT { .. }) y = f
> 
> 
> |  -Original Message-
> |  From: glasgow-haskell-users-boun...@haskell.org 
> [mailto:glasgow-haskell-users-
> |  boun...@haskell.org] On Behalf Of Serge D. Mechveliani
> |  Sent: 14 October 2010 11:01
> |  To: Antoine Latter
> |  Cc: glasgow-haskell-users@haskell.org
> |  Subject: Re: un-used record wildcards
> |  
> |  On Wed, Oct 13, 2010 at 01:47:11PM -0500, Antoine Latter wrote:
> |  > On Wed, Oct 13, 2010 at 1:02 PM, Serge D. Mechveliani 
> |  wrote:
> |  > > Dear GHC developers,
> |  > >
> |  > > I use the language extension of RecordWildcards, for example,
> |  > >                                f (Foo {foo1 = n, foo2 = m, ..}) = ...
> |  > >
> |  > > But the complier warns about un-used values of  foo3, foo4,
> |  > > probably, due to the extension of
> |  > >                     Foo {foo1 = n, foo2 = m, foo3 = foo3, foo4 = foo4}.
> |  > >
> |  > > In such cases, these warnings look as unneeded.
> |  > > Is it possible to have an un-used binding warnings with exception for
> |  > > wildcards in records?
> |  > > If not, then has it sense to introduce an option?
> |  > >
> |  >
> |  > If you're not using foo3 and foo4, can you not put it the ellipsis?
> |  > that won't cover every case (such as where you're using foo3 but not
> |  > foo4).
> |  >
> |  > Antoine
> |  >
> |  
> |  Indeed, thank you.
> |  It occurs that under RecordWildcards the compiler allows to skip some
> |  record fields in a pattern.
> |  ___
> |  Glasgow-haskell-users mailing list
> |  Glasgow-haskell-users@haskell.org
> |  http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
> 
> 
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: un-used record wildcards

2010-10-16 Thread Neil Mitchell
Hi Simon,

I've seen this issue with GHC 6.12.3 (and assumed it was by design).
It occurs with a slight modification of your example:

{-# LANGUAGE RecordWildCards #-}

module Test where

data T = MkT { f,g :: Int }

p x = let MkT{..} = x in f

This example warns about "Defined but not used: `g'" on the line
defining p. I've raised a GHC bug:
http://hackage.haskell.org/trac/ghc/ticket/4411 about this warning.

Thanks, Neil

> Which version of GHC are you using?  GHC 6.12 does not complain about unused 
> variables bound by "..".  Try this, which complains about y, but not g.
>
> Simon
>
> {-# LANGUAGE RecordWildCards #-}
> module Test where
>
> data T = MkT { f,g :: Int }
>
> p (MkT { .. }) y = f
>
>
> |  -Original Message-
> |  From: glasgow-haskell-users-boun...@haskell.org 
> [mailto:glasgow-haskell-users-
> |  boun...@haskell.org] On Behalf Of Serge D. Mechveliani
> |  Sent: 14 October 2010 11:01
> |  To: Antoine Latter
> |  Cc: glasgow-haskell-users@haskell.org
> |  Subject: Re: un-used record wildcards
> |
> |  On Wed, Oct 13, 2010 at 01:47:11PM -0500, Antoine Latter wrote:
> |  > On Wed, Oct 13, 2010 at 1:02 PM, Serge D. Mechveliani 
> |  wrote:
> |  > > Dear GHC developers,
> |  > >
> |  > > I use the language extension of RecordWildcards, for example,
> |  > >                                f (Foo {foo1 = n, foo2 = m, ..}) = ...
> |  > >
> |  > > But the complier warns about un-used values of  foo3, foo4,
> |  > > probably, due to the extension of
> |  > >                     Foo {foo1 = n, foo2 = m, foo3 = foo3, foo4 = foo4}.
> |  > >
> |  > > In such cases, these warnings look as unneeded.
> |  > > Is it possible to have an un-used binding warnings with exception for
> |  > > wildcards in records?
> |  > > If not, then has it sense to introduce an option?
> |  > >
> |  >
> |  > If you're not using foo3 and foo4, can you not put it the ellipsis?
> |  > that won't cover every case (such as where you're using foo3 but not
> |  > foo4).
> |  >
> |  > Antoine
> |  >
> |
> |  Indeed, thank you.
> |  It occurs that under RecordWildcards the compiler allows to skip some
> |  record fields in a pattern.
> |  ___
> |  Glasgow-haskell-users mailing list
> |  glasgow-haskell-us...@haskell.org
> |  http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>
> ___
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users@haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users