[GHC] #11541: Type errors sometimes has a lot of irrelevant information

GHC ghc-devs at haskell.org
Fri Feb 5 14:01:39 UTC 2016


#11541: Type errors sometimes has a lot of irrelevant information
-------------------------------------+-------------------------------------
           Reporter:  augustss       |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  7.8.3
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Here's an example.
 The essential part of the error message is
 {{{
     Couldn't match type `DeclS IString TLoc' with `DeclHeadS IString l'
 }}}
 This is buried somewhere in the middle.  Fixing this problem makes all the
 others go away.  It seems ghc spits out constraints that it hasn't solved,
 but they are unsolved because there was a type error.

 Full message:
 {{{
 Stem\Mu\Deriving.hs:214:93:
     No instance for (Integral b0) arising from a use of `constr'
     The type variable `b0' is ambiguous
     Note: there are several potential instances:
       instance Integral Int -- Defined in `GHC.Real'
       instance Integral Integer -- Defined in `GHC.Real'
       instance Integral GHC.Types.Word -- Defined in `GHC.Real'
       ...plus 8 others
     In the first argument of `zipWith', namely `constr'
     In the second argument of `($)', namely `zipWith constr qs [0 .. ]'
     In the expression: List () $ zipWith constr qs [0 .. ]

 Stem\Mu\Deriving.hs:214:103:
     No instance for (Enum b0)
       arising from the arithmetic sequence `0 .. '
     The type variable `b0' is ambiguous
     Note: there are several potential instances:
       instance Enum GeneralCategory -- Defined in `Data.Char'
       instance Enum InlInfo -- Defined in `Cortex.Stem.Mu.Util'
       instance Enum Double -- Defined in `GHC.Float'
       ...plus 24 others
     In the third argument of `zipWith', namely `[0 .. ]'
     In the second argument of `($)', namely `zipWith constr qs [0 .. ]'
     In the expression: List () $ zipWith constr qs [0 .. ]

 Stem\Mu\Deriving.hs:214:104:
     No instance for (Num b0) arising from the literal `0'
     The type variable `b0' is ambiguous
     Note: there are several potential instances:
       instance Num Double -- Defined in `GHC.Float'
       instance Num Float -- Defined in `GHC.Float'
       instance Integral a => Num (GHC.Real.Ratio a)
         -- Defined in `GHC.Real'
       ...plus 12 others
     In the expression: 0
     In the third argument of `zipWith', namely `[0 .. ]'
     In the second argument of `($)', namely `zipWith constr qs [0 .. ]'

 Stem\Mu\Deriving.hs:285:28:
     No instance for (Integral a0) arising from a use of `list'
     The type variable `a0' is ambiguous
     Note: there are several potential instances:
       instance Integral Int -- Defined in `GHC.Real'
       instance Integral Integer -- Defined in `GHC.Real'
       instance Integral GHC.Types.Word -- Defined in `GHC.Real'
       ...plus 8 others
     In the second argument of `($)', namely
       `list
          10 (mkstr (nameString n) : map (ashow (mkInt () 11) . qvar) vs)'
     In the second argument of `($)', namely
       `shows
        $ list
            10 (mkstr (nameString n) : map (ashow (mkInt () 11) . qvar)
 vs)'
     In the expression:
       method (PApp () (UnQual () $ dropAnn n) (map (PVar ()) vs))
       $ shows
         $ list
             10 (mkstr (nameString n) : map (ashow (mkInt () 11) . qvar)
 vs)

 Stem\Mu\Deriving.hs:285:33:
     No instance for (Num a0) arising from the literal `10'
     The type variable `a0' is ambiguous
     Note: there are several potential instances:
       instance Num Double -- Defined in `GHC.Float'
       instance Num Float -- Defined in `GHC.Float'
       instance Integral a => Num (GHC.Real.Ratio a)
         -- Defined in `GHC.Real'
       ...plus 12 others
     In the first argument of `list', namely `10'
     In the second argument of `($)', namely
       `list
          10 (mkstr (nameString n) : map (ashow (mkInt () 11) . qvar) vs)'
     In the second argument of `($)', namely
       `shows
        $ list
            10 (mkstr (nameString n) : map (ashow (mkInt () 11) . qvar)
 vs)'

 Stem\Mu\Deriving.hs:285:72:
     No instance for (Integral a1) arising from a use of `mkInt'
     The type variable `a1' is ambiguous
     Note: there are several potential instances:
       instance Integral Int -- Defined in `GHC.Real'
       instance Integral Integer -- Defined in `GHC.Real'
       instance Integral GHC.Types.Word -- Defined in `GHC.Real'
       ...plus 8 others
     In the first argument of `ashow', namely `(mkInt () 11)'
     In the first argument of `(.)', namely `ashow (mkInt () 11)'
     In the first argument of `map', namely
       `(ashow (mkInt () 11) . qvar)'

 Stem\Mu\Deriving.hs:285:81:
     No instance for (Num a1) arising from the literal `11'
     The type variable `a1' is ambiguous
     Note: there are several potential instances:
       instance Num Double -- Defined in `GHC.Float'
       instance Num Float -- Defined in `GHC.Float'
       instance Integral a => Num (GHC.Real.Ratio a)
         -- Defined in `GHC.Real'
       ...plus 12 others
     In the second argument of `mkInt', namely `11'
     In the first argument of `ashow', namely `(mkInt () 11)'
     In the first argument of `(.)', namely `ashow (mkInt () 11)'

 Stem\Mu\Deriving.hs:288:44:
     No instance for (Show a3) arising from a use of `var'
     The type variable `a3' is ambiguous
     Note: there are several potential instances:
       instance Show GeneralCategory -- Defined in `Data.Char'
       instance Show IString -- Defined in `Cortex.Utils.IString'
       instance Show a => Show (Cortex.Utils.List.Down a)
         -- Defined in `Cortex.Utils.List'
       ...plus 171 others
     In the second argument of `PVar', namely `(var 0)'
     In the second argument of `PInfixApp', namely `(PVar () (var 0))'
     In the first argument of `method', namely
       `(PInfixApp
           () (PVar () (var 0)) (UnQual () $ dropAnn n) (PVar () (var 1)))'

 Stem\Mu\Deriving.hs:288:48:
     No instance for (Num a3) arising from the literal `0'
     The type variable `a3' is ambiguous
     Note: there are several potential instances:
       instance Num Double -- Defined in `GHC.Float'
       instance Num Float -- Defined in `GHC.Float'
       instance Integral a => Num (GHC.Real.Ratio a)
         -- Defined in `GHC.Real'
       ...plus 12 others
     In the first argument of `var', namely `0'
     In the second argument of `PVar', namely `(var 0)'
     In the second argument of `PInfixApp', namely `(PVar () (var 0))'

 Stem\Mu\Deriving.hs:288:86:
     No instance for (Show a4) arising from a use of `var'
     The type variable `a4' is ambiguous
     Note: there are several potential instances:
       instance Show GeneralCategory -- Defined in `Data.Char'
       instance Show IString -- Defined in `Cortex.Utils.IString'
       instance Show a => Show (Cortex.Utils.List.Down a)
         -- Defined in `Cortex.Utils.List'
       ...plus 171 others
     In the second argument of `PVar', namely `(var 1)'
     In the fourth argument of `PInfixApp', namely `(PVar () (var 1))'
     In the first argument of `method', namely
       `(PInfixApp
           () (PVar () (var 0)) (UnQual () $ dropAnn n) (PVar () (var 1)))'

 Stem\Mu\Deriving.hs:288:90:
     No instance for (Num a4) arising from the literal `1'
     The type variable `a4' is ambiguous
     Note: there are several potential instances:
       instance Num Double -- Defined in `GHC.Float'
       instance Num Float -- Defined in `GHC.Float'
       instance Integral a => Num (GHC.Real.Ratio a)
         -- Defined in `GHC.Real'
       ...plus 12 others
     In the first argument of `var', namely `1'
     In the second argument of `PVar', namely `(var 1)'
     In the fourth argument of `PInfixApp', namely `(PVar () (var 1))'

 Stem\Mu\Deriving.hs:289:28:
     No instance for (Integral a5) arising from a use of `list'
     The type variable `a5' is ambiguous
     Note: there are several potential instances:
       instance Integral Int -- Defined in `GHC.Real'
       instance Integral Integer -- Defined in `GHC.Real'
       instance Integral GHC.Types.Word -- Defined in `GHC.Real'
       ...plus 8 others
     In the second argument of `($)', namely
       `list
          (precOf n)
          [ashow pp $ qvar $ var 0, mkstr (nameString n),
           ashow pp $ qvar $ var 1]'
     In the second argument of `($)', namely
       `shows
        $ list
            (precOf n)
            [ashow pp $ qvar $ var 0, mkstr (nameString n),
             ashow pp $ qvar $ var 1]'
     In the expression:
       method
         (PInfixApp
            () (PVar () (var 0)) (UnQual () $ dropAnn n) (PVar () (var 1)))
       $ shows
         $ list
             (precOf n)
             [ashow pp $ qvar $ var 0, mkstr (nameString n),
              ashow pp $ qvar $ var 1]

 Stem\Mu\Deriving.hs:289:34:
     No instance for (Num a5) arising from a use of `precOf'
     The type variable `a5' is ambiguous
     Note: there are several potential instances:
       instance Num Double -- Defined in `GHC.Float'
       instance Num Float -- Defined in `GHC.Float'
       instance Integral a => Num (GHC.Real.Ratio a)
         -- Defined in `GHC.Real'
       ...plus 12 others
     In the first argument of `list', namely `(precOf n)'
     In the second argument of `($)', namely
       `list
          (precOf n)
          [ashow pp $ qvar $ var 0, mkstr (nameString n),
           ashow pp $ qvar $ var 1]'
     In the second argument of `($)', namely
       `shows
        $ list
            (precOf n)
            [ashow pp $ qvar $ var 0, mkstr (nameString n),
             ashow pp $ qvar $ var 1]'

 Stem\Mu\Deriving.hs:289:63:
     No instance for (Show a6) arising from a use of `var'
     The type variable `a6' is ambiguous
     Note: there are several potential instances:
       instance Show GeneralCategory -- Defined in `Data.Char'
       instance Show IString -- Defined in `Cortex.Utils.IString'
       instance Show a => Show (Cortex.Utils.List.Down a)
         -- Defined in `Cortex.Utils.List'
       ...plus 171 others
     In the second argument of `($)', namely `var 0'
     In the second argument of `($)', namely `qvar $ var 0'
     In the expression: ashow pp $ qvar $ var 0

 Stem\Mu\Deriving.hs:289:67:
     No instance for (Num a6) arising from the literal `0'
     The type variable `a6' is ambiguous
     Note: there are several potential instances:
       instance Num Double -- Defined in `GHC.Float'
       instance Num Float -- Defined in `GHC.Float'
       instance Integral a => Num (GHC.Real.Ratio a)
         -- Defined in `GHC.Real'
       ...plus 12 others
     In the first argument of `var', namely `0'
     In the second argument of `($)', namely `var 0'
     In the second argument of `($)', namely `qvar $ var 0'

 Stem\Mu\Deriving.hs:289:110:
     No instance for (Show a7) arising from a use of `var'
     The type variable `a7' is ambiguous
     Note: there are several potential instances:
       instance Show GeneralCategory -- Defined in `Data.Char'
       instance Show IString -- Defined in `Cortex.Utils.IString'
       instance Show a => Show (Cortex.Utils.List.Down a)
         -- Defined in `Cortex.Utils.List'
       ...plus 171 others
     In the second argument of `($)', namely `var 1'
     In the second argument of `($)', namely `qvar $ var 1'
     In the expression: ashow pp $ qvar $ var 1

 Stem\Mu\Deriving.hs:289:114:
     No instance for (Num a7) arising from the literal `1'
     The type variable `a7' is ambiguous
     Note: there are several potential instances:
       instance Num Double -- Defined in `GHC.Float'
       instance Num Float -- Defined in `GHC.Float'
       instance Integral a => Num (GHC.Real.Ratio a)
         -- Defined in `GHC.Real'
       ...plus 12 others
     In the first argument of `var', namely `1'
     In the second argument of `($)', namely `var 1'
     In the second argument of `($)', namely `qvar $ var 1'

 Stem\Mu\Deriving.hs:290:37:
     No instance for (Integral a2) arising from a use of `mkInt'
     The type variable `a2' is ambiguous
     Note: there are several potential instances:
       instance Integral Int -- Defined in `GHC.Real'
       instance Integral Integer -- Defined in `GHC.Real'
       instance Integral GHC.Types.Word -- Defined in `GHC.Real'
       ...plus 8 others
     In the expression: mkInt () (precOf n + 1)
     In an equation for `pp': pp = mkInt () (precOf n + 1)
     In an equation for `sh':
         sh (QualConDecl _ _ _ (InfixConDecl _ t1 n t2))
           = method
               (PInfixApp
                  () (PVar () (var 0)) (UnQual () $ dropAnn n) (PVar ()
 (var 1)))
             $ shows
               $ list
                   (precOf n)
                   [ashow pp $ qvar $ var 0, mkstr (nameString n),
                    ashow pp $ qvar $ var 1]
           where
               pp = mkInt () (precOf n + 1)

 Stem\Mu\Deriving.hs:290:56:
     No instance for (Num a2) arising from a use of `+'
     The type variable `a2' is ambiguous
     Note: there are several potential instances:
       instance Num Double -- Defined in `GHC.Float'
       instance Num Float -- Defined in `GHC.Float'
       instance Integral a => Num (GHC.Real.Ratio a)
         -- Defined in `GHC.Real'
       ...plus 12 others
     In the second argument of `mkInt', namely `(precOf n + 1)'
     In the expression: mkInt () (precOf n + 1)
     In an equation for `pp': pp = mkInt () (precOf n + 1)

 Stem\Mu\Deriving.hs:297:47:
     No instance for (Integral a8) arising from a use of `mkInt'
     The type variable `a8' is ambiguous
     Note: there are several potential instances:
       instance Integral Int -- Defined in `GHC.Real'
       instance Integral Integer -- Defined in `GHC.Real'
       instance Integral GHC.Types.Word -- Defined in `GHC.Real'
       ...plus 8 others
     In the first argument of `ashow', namely `(mkInt () 0)'
     In the second argument of `aapp', namely
       `ashow (mkInt () 0) (qvar $ dropAnn n)'
     In the expression:
       mkstr (nameString n & " = ")
       `aapp` ashow (mkInt () 0) (qvar $ dropAnn n)

 Stem\Mu\Deriving.hs:297:56:
     No instance for (Num a8) arising from the literal `0'
     The type variable `a8' is ambiguous
     Note: there are several potential instances:
       instance Num Double -- Defined in `GHC.Float'
       instance Num Float -- Defined in `GHC.Float'
       instance Integral a => Num (GHC.Real.Ratio a)
         -- Defined in `GHC.Real'
       ...plus 12 others
     In the second argument of `mkInt', namely `0'
     In the first argument of `ashow', namely `(mkInt () 0)'
     In the second argument of `aapp', namely
       `ashow (mkInt () 0) (qvar $ dropAnn n)'

 Stem\Mu\Deriving.hs:337:44:
     No instance for (Show a10) arising from a use of `varx'
     The type variable `a10' is ambiguous
     Note: there are several potential instances:
       instance Show GeneralCategory -- Defined in `Data.Char'
       instance Show IString -- Defined in `Cortex.Utils.IString'
       instance Show a => Show (Cortex.Utils.List.Down a)
         -- Defined in `Cortex.Utils.List'
       ...plus 171 others
     In the first argument of `map', namely `varx'
     In the expression: map varx [0, 1]
     In a pattern binding: [x0, x1] = map varx [0, 1]

 Stem\Mu\Deriving.hs:337:50:
     No instance for (Num a10) arising from the literal `0'
     The type variable `a10' is ambiguous
     Note: there are several potential instances:
       instance Num Double -- Defined in `GHC.Float'
       instance Num Float -- Defined in `GHC.Float'
       instance Integral a => Num (GHC.Real.Ratio a)
         -- Defined in `GHC.Real'
       ...plus 12 others
     In the expression: 0
     In the second argument of `map', namely `[0, 1]'
     In the expression: map varx [0, 1]

 Stem\Mu\Deriving.hs:338:44:
     No instance for (Show a9) arising from a use of `vary'
     The type variable `a9' is ambiguous
     Note: there are several potential instances:
       instance Show GeneralCategory -- Defined in `Data.Char'
       instance Show IString -- Defined in `Cortex.Utils.IString'
       instance Show a => Show (Cortex.Utils.List.Down a)
         -- Defined in `Cortex.Utils.List'
       ...plus 171 others
     In the first argument of `map', namely `vary'
     In the expression: map vary [0, 1]
     In a pattern binding: [y0, y1] = map vary [0, 1]

 Stem\Mu\Deriving.hs:338:50:
     No instance for (Num a9) arising from the literal `0'
     The type variable `a9' is ambiguous
     Note: there are several potential instances:
       instance Num Double -- Defined in `GHC.Float'
       instance Num Float -- Defined in `GHC.Float'
       instance Integral a => Num (GHC.Real.Ratio a)
         -- Defined in `GHC.Real'
       ...plus 12 others
     In the expression: 0
     In the second argument of `map', namely `[0, 1]'
     In the expression: map vary [0, 1]

 Stem\Mu\Deriving.hs:366:33:
     Couldn't match type `DeclS IString TLoc' with `DeclHeadS IString l'
     Expected type: DeclHead l
       Actual type: Decl TLoc
     Relevant bindings include
       n :: Name l (bound at Stem\Mu\Deriving.hs:366:10)
       vs :: [TyVarBind l] (bound at Stem\Mu\Deriving.hs:366:13)
     In the first argument of `splitDeclHead', namely `dh'
     In the expression: splitDeclHead dh

 Stem\Mu\Deriving.hs:392:44:
     No instance for (Show a14) arising from a use of `varx'
     The type variable `a14' is ambiguous
     Note: there are several potential instances:
       instance Show GeneralCategory -- Defined in `Data.Char'
       instance Show IString -- Defined in `Cortex.Utils.IString'
       instance Show a => Show (Cortex.Utils.List.Down a)
         -- Defined in `Cortex.Utils.List'
       ...plus 171 others
     In the first argument of `map', namely `varx'
     In the expression: map varx [0, 1]
     In a pattern binding: [x0, x1] = map varx [0, 1]

 Stem\Mu\Deriving.hs:392:50:
     No instance for (Num a14) arising from the literal `0'
     The type variable `a14' is ambiguous
     Note: there are several potential instances:
       instance Num Double -- Defined in `GHC.Float'
       instance Num Float -- Defined in `GHC.Float'
       instance Integral a => Num (GHC.Real.Ratio a)
         -- Defined in `GHC.Real'
       ...plus 12 others
     In the expression: 0
     In the second argument of `map', namely `[0, 1]'
     In the expression: map varx [0, 1]

 Stem\Mu\Deriving.hs:393:44:
     No instance for (Show a13) arising from a use of `vary'
     The type variable `a13' is ambiguous
     Note: there are several potential instances:
       instance Show GeneralCategory -- Defined in `Data.Char'
       instance Show IString -- Defined in `Cortex.Utils.IString'
       instance Show a => Show (Cortex.Utils.List.Down a)
         -- Defined in `Cortex.Utils.List'
       ...plus 171 others
     In the first argument of `map', namely `vary'
     In the expression: map vary [0, 1]
     In a pattern binding: [y0, y1] = map vary [0, 1]

 Stem\Mu\Deriving.hs:393:50:
     No instance for (Num a13) arising from the literal `0'
     The type variable `a13' is ambiguous
     Note: there are several potential instances:
       instance Num Double -- Defined in `GHC.Float'
       instance Num Float -- Defined in `GHC.Float'
       instance Integral a => Num (GHC.Real.Ratio a)
         -- Defined in `GHC.Real'
       ...plus 12 others
     In the expression: 0
     In the second argument of `map', namely `[0, 1]'
     In the expression: map vary [0, 1]
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11541>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list