Skip to content

Erroneous Redundant constraint warning

Using version 4425ab99 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

     let rowOffset = case typeSig of
                        [] -> 2
                        _  -> 1
Trac metadata
Trac field Value
Version 7.11
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC simonpj
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information