[GHC] #12810: -Wredundant-constraints doesn't factor in associated type families
GHC
ghc-devs at haskell.org
Sat Nov 5 20:27:38 UTC 2016
#12810: -Wredundant-constraints doesn't factor in associated type families
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
(Type checker) |
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: Incorrect
Unknown/Multiple | error/warning at compile-time
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
If I compile this code:
{{{#!hs
{-# LANGUAGE TypeFamilies #-}
module M where
class C a where
type T a
instance C a => C [a] where
type T [a] = T a
}}}
with `-Wredundant-constraints` enabled, it complains:
{{{
$ /opt/ghc/head/bin/ghc -Wredundant-constraints M.hs
[1 of 1] Compiling M ( M.hs, M.o )
M.hs:7:10: warning: [-Wredundant-constraints]
• Redundant constraint: C a
• In the instance declaration for ‘C [a]’
}}}
I don't think this is right. The RHS of `T [a]` won't be able to reduce
unless there's a `T a` instance available–that is, unless there's a `C a`
instance available, which is what the context provides, making it non-
redundant.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12810>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list