Re: suppress warning "Defined but not used: type variable ‘x’" in GHC-8.0

Andrew Farmer xichekolas at gmail.com
Sun Jan 17 08:16:09 UTC 2016


Can't you just:

instance Foo [a] where
  type Bar [_a] = Int

(At least I think I did that somewhere...)
On Jan 16, 2016 9:24 PM, "Edward Kmett" <ekmett at gmail.com> wrote:

> As a data point I now get thousands of occurrences of this warning across
> my packages.
>
> It is quite annoying.
>
> class Foo a where
>   type Bar a
>
> instance Foo [a] where
>   type Bar [a] = Int
>
> is enough to trigger it.
>
> And you can't turn it off by using _ as
>
> instance Foo [_] where
>   type Bar [_] = Int
>
> isn't legal.
>
> I've been avoiding it for now by using
>
>   if impl(ghc >= 8)
>
>     ghc-options: -fno-warn-unused-matches
>
> but this is a pretty awful addition to this warning as it stands.
> -Edward
>
> On Mon, Jan 11, 2016 at 2:12 PM, Henning Thielemann <
> lemming at henning-thielemann.de> wrote:
>
>>
>> On Mon, 11 Jan 2016, Richard Eisenberg wrote:
>>
>> On Jan 9, 2016, at 6:44 PM, Henning Thielemann <
>>> lemming at henning-thielemann.de> wrote:
>>>
>>>>
>>>> instance (Natural n) => Num.Integer (Un n) where
>>>>    type Repr (Un _n) = Unary
>>>>
>>>>
>>>> GHC-7.6.3 and GHC-7.4.2 complain:
>>>>    Type indexes must match class instance head
>>>>    Found `Un _n' but expected `Un n'
>>>>    In the type synonym instance declaration for `Num.Repr'
>>>>    In the instance declaration for `Num.Integer (Un n)'
>>>>
>>>>
>>>> GHC-7.8.4, GHC-7.10.3 and GHC-8.0 are happy with the difference.
>>>>
>>>
>>> I'm surprised this is accepted at all. Looks like hogwash to me. I think
>>> you should post a bug report.
>>>
>>
>> Ok, but then GHC must not warn about the unused argument of Repr.
>>
>> _______________________________________________
>> Glasgow-haskell-users mailing list
>> Glasgow-haskell-users at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
>>
>
>
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/glasgow-haskell-users/attachments/20160117/73217512/attachment.html>


More information about the Glasgow-haskell-users mailing list