[GHC] #9973: Erroneous Redundant constraint warning
GHC
ghc-devs at haskell.org
Fri Jan 9 13:45:59 UTC 2015
#9973: Erroneous Redundant constraint warning
-------------------------------------+-------------------------------------
Reporter: alanz | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.11
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple | Blocked By:
Test Case: | Related Tickets:
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
Using version 4425ab99d6410839fa7567950b0a4696b0a3d70f with D538 applied,
If the attached source file is loaded as is into ghci it generates the
following warning for line 5, but otherwise loads fine
{{{
/home/alanz/mysrc/github/alanz/HaRe/Bug2.hs:5:18: Warning:
Redundant constraint: SYB.Data t
In the type signature for:
duplicateDecl :: SYB.Data t =>
[GHC.LHsBind GHC.Name]
-> t -> GHC.Name -> GHC.Name -> IO [GHC.LHsBind
GHC.Name]
}}}
If the constraint is commented out, it results in an error
{{{
/home/alanz/mysrc/github/alanz/HaRe/Bug2.hs:26:16:
No instance for (SYB.Data t)
arising from a use of ‘definingSigsNames’
Possible fix:
add (SYB.Data t) to the context of
the type signature for:
duplicateDecl :: [GHC.LHsBind GHC.Name]
-> t -> GHC.Name -> GHC.Name -> IO [GHC.LHsBind
GHC.Name]
In the expression: definingSigsNames [n] sigs
In an equation for ‘typeSig’: typeSig = definingSigsNames [n] sigs
In an equation for ‘duplicateDecl’:
duplicateDecl decls sigs n newFunName
= do { let sspan = ...;
newSpan <- case typeSig of {
[] -> return sspan
_ -> ... };
let rowOffset = ...;
.... }
where
typeSig = definingSigsNames [n] sigs
Failed, modules loaded: none.
}}}
This behaviour goes away if the following lines are commented out
{{{#!hs
let rowOffset = case typeSig of
[] -> 2
_ -> 1
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9973>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list