diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2015-09-02 14:05:36 +0200 |
---|---|---|
committer | Ben Gamari <bgamari.foss@gmail.com> | 2015-09-02 09:11:51 -0400 |
commit | 28ac9d31bcabeb44496c0e1750563f3091c62da9 (patch) | |
tree | 427a29e1beca0ee3fee7a1bc825bb5fa2fa03dae | |
parent | c8f623e305ec0a51ac2406a1f754d244e05b96f5 (diff) | |
download | haskell-28ac9d31bcabeb44496c0e1750563f3091c62da9.tar.gz |
Improve the error messages for class instance errors
Summary: See Note [Displaying potential instances].
Reviewers: austin
Subscribers: KaneTW, thomie
Differential Revision: https://phabricator.haskell.org/D1176
25 files changed, 497 insertions, 461 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 0423e78bb6..0dacb0c579 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -338,6 +338,7 @@ data GeneralFlag | Opt_PrintExplicitKinds | Opt_PrintUnicodeSyntax | Opt_PrintExpandedSynonyms + | Opt_PrintPotentialInstances -- optimisation opts | Opt_CallArity @@ -3014,6 +3015,7 @@ fFlags = [ flagSpec "print-explicit-kinds" Opt_PrintExplicitKinds, flagSpec "print-unicode-syntax" Opt_PrintUnicodeSyntax, flagSpec "print-expanded-synonyms" Opt_PrintExpandedSynonyms, + flagSpec "print-potential-instances" Opt_PrintPotentialInstances, flagSpec "prof-cafs" Opt_AutoSccsOnIndividualCafs, flagSpec "prof-count-entries" Opt_ProfCountEntries, flagSpec "regs-graph" Opt_RegsGraph, diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index 9694305b24..f91968dc97 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -33,6 +33,7 @@ import Id import Var import VarSet import VarEnv +import NameSet import Bag import ErrUtils ( ErrMsg, pprLocErrMsg ) import BasicTypes @@ -1530,10 +1531,9 @@ mk_dict_err ctxt (ct, (matches, unifiers, unsafe_overlapped)) potential_msg = ppWhen (not (null unifiers) && want_potential orig) $ - hang (if isSingleton unifiers - then ptext (sLit "Note: there is a potential instance available:") - else ptext (sLit "Note: there are several potential instances:")) - 2 (ppr_insts (sortBy fuzzyClsInstCmp unifiers)) + sdocWithDynFlags $ \dflags -> + getPprStyle $ \sty -> + pprPotentials dflags sty (ptext (sLit "Potential instances:")) unifiers -- Report "potential instances" only when the constraint arises -- directly from the user's use of an overloaded function @@ -1587,8 +1587,10 @@ mk_dict_err ctxt (ct, (matches, unifiers, unsafe_overlapped)) sep [ptext (sLit "Matching givens (or their superclasses):") , nest 2 (vcat matching_givens)] - , sep [ptext (sLit "Matching instances:"), - nest 2 (vcat [pprInstances ispecs, pprInstances unifiers])] + , sdocWithDynFlags $ \dflags -> + getPprStyle $ \sty -> + pprPotentials dflags sty (ptext (sLit "Matching instances:")) $ + ispecs ++ unifiers , ppWhen (null matching_givens && isSingleton matches && null unifiers) $ -- Intuitively, some given matched the wanted in their @@ -1670,17 +1672,86 @@ show_fixes [] = empty show_fixes (f:fs) = sep [ ptext (sLit "Possible fix:") , nest 2 (vcat (f : map (ptext (sLit "or") <+>) fs))] -ppr_insts :: [ClsInst] -> SDoc -ppr_insts insts - = pprInstances (take 3 insts) $$ dot_dot_message +pprPotentials :: DynFlags -> PprStyle -> SDoc -> [ClsInst] -> SDoc +-- See Note [Displaying potential instances] +pprPotentials dflags sty herald insts + | null insts + = empty + + | null show_these + = hang herald + 2 (vcat [ not_in_scope_msg empty + , flag_hint ]) + + | otherwise + = hang herald + 2 (vcat [ pprInstances show_these + , ppWhen (n_in_scope_hidden > 0) $ + ptext (sLit "...plus") + <+> speakNOf n_in_scope_hidden (ptext (sLit "other")) + , not_in_scope_msg (ptext (sLit "...plus")) + , flag_hint ]) where - n_extra = length insts - 3 - dot_dot_message - | n_extra <= 0 = empty - | otherwise = ptext (sLit "...plus") - <+> speakNOf n_extra (ptext (sLit "other")) + n_show = 3 :: Int + show_potentials = gopt Opt_PrintPotentialInstances dflags + + (in_scope, not_in_scope) = partition inst_in_scope insts + sorted = sortBy fuzzyClsInstCmp in_scope + show_these | show_potentials = sorted + | otherwise = take n_show sorted + n_in_scope_hidden = length sorted - length show_these + + -- "in scope" means that all the type constructors + -- are lexically in scope; these instances are likely + -- to be more useful + inst_in_scope :: ClsInst -> Bool + inst_in_scope cls_inst = foldNameSet ((&&) . name_in_scope) True $ + orphNamesOfTypes (is_tys cls_inst) + + name_in_scope name + | isBuiltInSyntax name + = True -- E.g. (->) + | Just mod <- nameModule_maybe name + = qual_in_scope (qualName sty mod (nameOccName name)) + | otherwise + = True + + qual_in_scope :: QualifyName -> Bool + qual_in_scope NameUnqual = True + qual_in_scope (NameQual {}) = True + qual_in_scope _ = False + + not_in_scope_msg herald + | null not_in_scope + = empty + | otherwise + = hang (herald <+> speakNOf (length not_in_scope) + (ptext (sLit "instance involving out-of-scope types"))) + 2 (ppWhen show_potentials (pprInstances not_in_scope)) + + flag_hint = ppUnless (show_potentials || length show_these == length insts) $ + ptext (sLit "(use -fprint-potential-instances to see them all)") + +{- Note [Displaying potential instances] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +When showing a list of instances for + - overlapping instances (show ones that match) + - no such instance (show ones that could match) +we want to give it a bit of structure. Here's the plan + +* Say that an instance is "in scope" if all of the + type constructors it mentions are lexically in scope. + These are the ones most likely to be useful to the programmer. + +* Show at most n_show in-scope instances, + and summarise the rest ("plus 3 others") + +* Summarise the not-in-scope instances ("plus 4 not in scope") + +* Add the flag -fshow-potential-instances which replaces the + summary with the full list +-} ----------------------- quickFlattenTy :: TcType -> TcM TcType -- See Note [Flattening in error message generation] quickFlattenTy ty | Just ty' <- tcView ty = quickFlattenTy ty' @@ -1705,9 +1776,8 @@ quickFlattenTy (TyConApp tc tys) ; flat_resttys <- mapM quickFlattenTy resttys ; return (foldl AppTy (mkTyVarTy v) flat_resttys) } -{- -Note [Flattening in error message generation] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +{- Note [Flattening in error message generation] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider (C (Maybe (F x))), where F is a type function, and we have instances C (Maybe Int) and C (Maybe a) diff --git a/docs/users_guide/flags.xml b/docs/users_guide/flags.xml index 0683752ee6..24917af252 100644 --- a/docs/users_guide/flags.xml +++ b/docs/users_guide/flags.xml @@ -36,6 +36,12 @@ <entry>-</entry> </row> <row> + <entry><option>-fprint-potential-instances</option></entry> + <entry>display all available instances in type error messages</entry> + <entry>dynamic</entry> + <entry>-fno-print-potential-instances</entry> + </row> + <row> <entry><option>-fprint-explicit-foralls</option></entry> <entry>Print explicit <literal>forall</literal> quantification in types. See also <option>-XExplicitForAll</option></entry> <entry>dynamic</entry> diff --git a/docs/users_guide/using.xml b/docs/users_guide/using.xml index 502f7a3401..71d3467bbb 100644 --- a/docs/users_guide/using.xml +++ b/docs/users_guide/using.xml @@ -894,6 +894,16 @@ ghc -c Foo.hs </listitem> </varlistentry> + <varlistentry> + <term><option>--fprint-potential-instances</option> + <indexterm><primary><option>-fprint-potential-instances</option></primary></indexterm> + </term> + <listitem> + <para>When GHC can't find an instance for a class, it displays a short list of some + in the instances it knows about. With this flag it prints <emphasis>all</emphasis> + the instances it knows about. + </para></listitem> + </varlistentry> <varlistentry> <term><option>-fprint-explicit-foralls, -fprint-explicit-kinds, -fprint-unicode-syntax</option> diff --git a/testsuite/tests/annotations/should_fail/annfail10.stderr b/testsuite/tests/annotations/should_fail/annfail10.stderr index 5ac8ab50b3..a8236709c2 100644 --- a/testsuite/tests/annotations/should_fail/annfail10.stderr +++ b/testsuite/tests/annotations/should_fail/annfail10.stderr @@ -1,25 +1,27 @@ -
-annfail10.hs:9:1:
- No instance for (Data a0) arising from an annotation
- The type variable ‘a0’ is ambiguous
- Note: there are several potential instances:
- instance (Data a, Data b) => Data (Either a b)
- -- Defined in ‘Data.Data’
- instance Data All -- Defined in ‘Data.Data’
- instance (Data (f a), Data a, Typeable f) => Data (Alt f a)
- -- Defined in ‘Data.Data’
- ...plus 39 others
- In the annotation: {-# ANN f 1 #-}
-
-annfail10.hs:9:11:
- No instance for (Num a0) arising from the literal ‘1’
- The type variable ‘a0’ is ambiguous
- Note: there are several potential instances:
- instance forall (k :: BOX) (f :: k -> *) (a :: k).
- Num (f a) =>
- Num (Alt f a)
- -- Defined in ‘Data.Monoid’
- instance Num a => Num (Product a) -- Defined in ‘Data.Monoid’
- instance Num a => Num (Sum a) -- Defined in ‘Data.Monoid’
- ...plus 14 others
- In the annotation: {-# ANN f 1 #-}
+ +annfail10.hs:9:1: error: + No instance for (Data a0) arising from an annotation + The type variable ‘a0’ is ambiguous + Potential instances: + instance (Data a, Data b) => Data (Either a b) + -- Defined in ‘Data.Data’ + instance Data All -- Defined in ‘Data.Data’ + instance (Data (f a), Data a, Typeable f) => Data (Alt f a) + -- Defined in ‘Data.Data’ + ...plus 39 others + (use -fprint-potential-instances to see them all) + In the annotation: {-# ANN f 1 #-} + +annfail10.hs:9:11: error: + No instance for (Num a0) arising from the literal ‘1’ + The type variable ‘a0’ is ambiguous + Potential instances: + instance forall (k :: BOX) (f :: k -> *) (a :: k). + Num (f a) => + Num (Alt f a) + -- Defined in ‘Data.Monoid’ + instance Num a => Num (Product a) -- Defined in ‘Data.Monoid’ + instance Num a => Num (Sum a) -- Defined in ‘Data.Monoid’ + ...plus 14 others + (use -fprint-potential-instances to see them all) + In the annotation: {-# ANN f 1 #-} diff --git a/testsuite/tests/ghci.debugger/scripts/break006.stderr b/testsuite/tests/ghci.debugger/scripts/break006.stderr index 9822dd785b..bf96e55e9e 100644 --- a/testsuite/tests/ghci.debugger/scripts/break006.stderr +++ b/testsuite/tests/ghci.debugger/scripts/break006.stderr @@ -1,32 +1,34 @@ -
-<interactive>:5:1:
- No instance for (Show t1) arising from a use of ‘print’
- Cannot resolve unknown runtime type ‘t1’
- Use :print or :force to determine these types
- Relevant bindings include it :: t1 (bound at <interactive>:5:1)
- Note: there are several potential instances:
- instance (Show a, Show b) => Show (Either a b)
- -- Defined in ‘Data.Either’
- instance Show All -- Defined in ‘Data.Monoid’
- instance forall (k :: BOX) (f :: k -> *) (a :: k).
- Show (f a) =>
- Show (Alt f a)
- -- Defined in ‘Data.Monoid’
- ...plus 33 others
- In a stmt of an interactive GHCi command: print it
-
-<interactive>:7:1:
- No instance for (Show t1) arising from a use of ‘print’
- Cannot resolve unknown runtime type ‘t1’
- Use :print or :force to determine these types
- Relevant bindings include it :: t1 (bound at <interactive>:7:1)
- Note: there are several potential instances:
- instance (Show a, Show b) => Show (Either a b)
- -- Defined in ‘Data.Either’
- instance Show All -- Defined in ‘Data.Monoid’
- instance forall (k :: BOX) (f :: k -> *) (a :: k).
- Show (f a) =>
- Show (Alt f a)
- -- Defined in ‘Data.Monoid’
- ...plus 33 others
- In a stmt of an interactive GHCi command: print it
+ +<interactive>:5:1: error: + No instance for (Show t1) arising from a use of ‘print’ + Cannot resolve unknown runtime type ‘t1’ + Use :print or :force to determine these types + Relevant bindings include it :: t1 (bound at <interactive>:5:1) + Potential instances: + instance (Show a, Show b) => Show (Either a b) + -- Defined in ‘Data.Either’ + instance Show All -- Defined in ‘Data.Monoid’ + instance forall (k :: BOX) (f :: k -> *) (a :: k). + Show (f a) => + Show (Alt f a) + -- Defined in ‘Data.Monoid’ + ...plus 33 others + (use -fprint-potential-instances to see them all) + In a stmt of an interactive GHCi command: print it + +<interactive>:7:1: error: + No instance for (Show t1) arising from a use of ‘print’ + Cannot resolve unknown runtime type ‘t1’ + Use :print or :force to determine these types + Relevant bindings include it :: t1 (bound at <interactive>:7:1) + Potential instances: + instance (Show a, Show b) => Show (Either a b) + -- Defined in ‘Data.Either’ + instance Show All -- Defined in ‘Data.Monoid’ + instance forall (k :: BOX) (f :: k -> *) (a :: k). + Show (f a) => + Show (Alt f a) + -- Defined in ‘Data.Monoid’ + ...plus 33 others + (use -fprint-potential-instances to see them all) + In a stmt of an interactive GHCi command: print it diff --git a/testsuite/tests/ghci.debugger/scripts/print019.stderr b/testsuite/tests/ghci.debugger/scripts/print019.stderr index 15c9f839db..39bc29fae9 100644 --- a/testsuite/tests/ghci.debugger/scripts/print019.stderr +++ b/testsuite/tests/ghci.debugger/scripts/print019.stderr @@ -1,12 +1,13 @@ -<interactive>:10:1: +<interactive>:10:1: error: No instance for (Show a1) arising from a use of ‘print’ Cannot resolve unknown runtime type ‘a1’ Use :print or :force to determine these types Relevant bindings include it :: a1 (bound at <interactive>:10:1) - Note: there are several potential instances: + Potential instances: instance Show TyCon -- Defined in ‘Data.Typeable.Internal’ instance Show TypeRep -- Defined in ‘Data.Typeable.Internal’ instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’ ...plus 30 others + (use -fprint-potential-instances to see them all) In a stmt of an interactive GHCi command: print it diff --git a/testsuite/tests/ghci/scripts/Defer02.stderr b/testsuite/tests/ghci/scripts/Defer02.stderr index cc5ae21d20..b2a5efefc3 100644 --- a/testsuite/tests/ghci/scripts/Defer02.stderr +++ b/testsuite/tests/ghci/scripts/Defer02.stderr @@ -1,193 +1,194 @@ -
-..\..\typecheck\should_run\Defer01.hs:11:40: warning:
- Couldn't match type ‘Char’ with ‘[Char]’
- Expected type: String
- Actual type: Char
- In the first argument of ‘putStr’, namely ‘','’
- In the second argument of ‘(>>)’, namely ‘putStr ','’
- In the expression: putStr "Hello World" >> putStr ','
-
-..\..\typecheck\should_run\Defer01.hs:14:5: warning:
- Couldn't match expected type ‘Int’ with actual type ‘Char’
- In the expression: 'p'
- In an equation for ‘a’: a = 'p'
-
-..\..\typecheck\should_run\Defer01.hs:18:9: warning:
- No instance for (Eq B) arising from a use of ‘==’
- In the expression: x == x
- In an equation for ‘b’: b x = x == x
-
-..\..\typecheck\should_run\Defer01.hs:25:4: warning:
- Couldn't match type ‘Int’ with ‘Bool’
- Inaccessible code in
- a pattern with constructor: C2 :: Bool -> C Bool,
- in an equation for ‘c’
- In the pattern: C2 x
- In an equation for ‘c’: c (C2 x) = True
-
-..\..\typecheck\should_run\Defer01.hs:28:5: warning:
- No instance for (Num (a -> a)) arising from the literal ‘1’
- (maybe you haven't applied a function to enough arguments?)
- In the expression: 1
- In an equation for ‘d’: d = 1
-
-..\..\typecheck\should_run\Defer01.hs:31:5: warning:
- Couldn't match expected type ‘Char -> t’ with actual type ‘Char’
- Relevant bindings include
- f :: t (bound at ..\..\typecheck\should_run\Defer01.hs:31:1)
- The function ‘e’ is applied to one argument,
- but its type ‘Char’ has none
- In the expression: e 'q'
- In an equation for ‘f’: f = e 'q'
-
-..\..\typecheck\should_run\Defer01.hs:34:8: warning:
- Couldn't match expected type ‘Char’ with actual type ‘a’
- ‘a’ is a rigid type variable bound by
- the type signature for:
- h :: a -> (Char, Char)
- at ..\..\typecheck\should_run\Defer01.hs:33:6
- Relevant bindings include
- x :: a (bound at ..\..\typecheck\should_run\Defer01.hs:34:3)
- h :: a -> (Char, Char)
- (bound at ..\..\typecheck\should_run\Defer01.hs:34:1)
- In the expression: x
- In the expression: (x, 'c')
-
-..\..\typecheck\should_run\Defer01.hs:39:17: warning:
- Couldn't match expected type ‘Bool’ with actual type ‘T a’
- Relevant bindings include
- a :: a (bound at ..\..\typecheck\should_run\Defer01.hs:39:3)
- i :: a -> () (bound at ..\..\typecheck\should_run\Defer01.hs:39:1)
- In the first argument of ‘not’, namely ‘(K a)’
- In the expression: (not (K a))
-
-..\..\typecheck\should_run\Defer01.hs:43:5: warning:
- No instance for (MyClass a1) arising from a use of ‘myOp’
- In the expression: myOp 23
- In an equation for ‘j’: j = myOp 23
-
-..\..\typecheck\should_run\Defer01.hs:43:10: warning:
- No instance for (Num a1) arising from the literal ‘23’
- The type variable ‘a1’ is ambiguous
- Note: there are several potential instances:
- instance Num Integer -- Defined in ‘GHC.Num’
- instance Num Double -- Defined in ‘GHC.Float’
- instance Num Float -- Defined in ‘GHC.Float’
- ...plus two others
- In the first argument of ‘myOp’, namely ‘23’
- In the expression: myOp 23
- In an equation for ‘j’: j = myOp 23
-
-..\..\typecheck\should_run\Defer01.hs:45:6: warning:
- Couldn't match type ‘Int’ with ‘Bool’
- Inaccessible code in
- the type signature for:
- k :: (Int ~ Bool) => Int -> Bool
- In the ambiguity check for the type signature for ‘k’:
- k :: (Int ~ Bool) => Int -> Bool
- To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
- In the type signature for ‘k’: k :: (Int ~ Bool) => Int -> Bool
-
-..\..\typecheck\should_run\Defer01.hs:45:6: warning:
- Couldn't match expected type ‘Bool’ with actual type ‘Int’
- In the ambiguity check for the type signature for ‘k’:
- k :: (Int ~ Bool) => Int -> Bool
- To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
- In the type signature for ‘k’: k :: (Int ~ Bool) => Int -> Bool
-
-..\..\typecheck\should_run\Defer01.hs:45:6: warning:
- Couldn't match type ‘Int’ with ‘Bool’
- Inaccessible code in
- the type signature for:
- k :: (Int ~ Bool) => Int -> Bool
-
-..\..\typecheck\should_run\Defer01.hs:46:7: warning:
- Couldn't match expected type ‘Bool’ with actual type ‘Int’
- In the expression: x
- In an equation for ‘k’: k x = x
-
-..\..\typecheck\should_run\Defer01.hs:49:5: warning:
- Couldn't match expected type ‘IO a0’
- with actual type ‘Char -> IO ()’
- Probable cause: ‘putChar’ is applied to too few arguments
- In the first argument of ‘(>>)’, namely ‘putChar’
- In the expression: putChar >> putChar 'p'
-*** Exception: ..\..\typecheck\should_run\Defer01.hs:11:40: error:
- Couldn't match type ‘Char’ with ‘[Char]’
- Expected type: String
- Actual type: Char
- In the first argument of ‘putStr’, namely ‘','’
- In the second argument of ‘(>>)’, namely ‘putStr ','’
- In the expression: putStr "Hello World" >> putStr ','
-(deferred type error)
-*** Exception: ..\..\typecheck\should_run\Defer01.hs:14:5: error:
- Couldn't match expected type ‘Int’ with actual type ‘Char’
- In the expression: 'p'
- In an equation for ‘a’: a = 'p'
-(deferred type error)
-*** Exception: ..\..\typecheck\should_run\Defer01.hs:18:9: error:
- No instance for (Eq B) arising from a use of ‘==’
- In the expression: x == x
- In an equation for ‘b’: b x = x == x
-(deferred type error)
-
-<interactive>:7:11: error:
- Couldn't match type ‘Bool’ with ‘Int’
- Expected type: C Int
- Actual type: C Bool
- In the first argument of ‘c’, namely ‘(C2 True)’
- In the first argument of ‘print’, namely ‘(c (C2 True))’
-*** Exception: ..\..\typecheck\should_run\Defer01.hs:28:5: error:
- No instance for (Num (a -> a)) arising from the literal ‘1’
- (maybe you haven't applied a function to enough arguments?)
- In the expression: 1
- In an equation for ‘d’: d = 1
-(deferred type error)
-*** Exception: ..\..\typecheck\should_run\Defer01.hs:31:5: error:
- Couldn't match expected type ‘Char -> t’ with actual type ‘Char’
- Relevant bindings include
- f :: t (bound at ..\..\typecheck\should_run\Defer01.hs:31:1)
- The function ‘e’ is applied to one argument,
- but its type ‘Char’ has none
- In the expression: e 'q'
- In an equation for ‘f’: f = e 'q'
-(deferred type error)
-*** Exception: ..\..\typecheck\should_run\Defer01.hs:34:8: error:
- Couldn't match expected type ‘Char’ with actual type ‘a’
- ‘a’ is a rigid type variable bound by
- the type signature for:
- h :: a -> (Char, Char)
- at ..\..\typecheck\should_run\Defer01.hs:33:6
- Relevant bindings include
- x :: a (bound at ..\..\typecheck\should_run\Defer01.hs:34:3)
- h :: a -> (Char, Char)
- (bound at ..\..\typecheck\should_run\Defer01.hs:34:1)
- In the expression: x
- In the expression: (x, 'c')
-(deferred type error)
-*** Exception: ..\..\typecheck\should_run\Defer01.hs:39:17: error:
- Couldn't match expected type ‘Bool’ with actual type ‘T a’
- Relevant bindings include
- a :: a (bound at ..\..\typecheck\should_run\Defer01.hs:39:3)
- i :: a -> () (bound at ..\..\typecheck\should_run\Defer01.hs:39:1)
- In the first argument of ‘not’, namely ‘(K a)’
- In the expression: (not (K a))
-(deferred type error)
-*** Exception: ..\..\typecheck\should_run\Defer01.hs:43:5: error:
- No instance for (MyClass a1) arising from a use of ‘myOp’
- In the expression: myOp 23
- In an equation for ‘j’: j = myOp 23
-(deferred type error)
-
-<interactive>:13:8: error:
- Couldn't match expected type ‘Bool’ with actual type ‘Int’
- In the first argument of ‘print’, namely ‘(k 2)’
- In the expression: print (k 2)
- In an equation for ‘it’: it = print (k 2)
-*** Exception: ..\..\typecheck\should_run\Defer01.hs:49:5: error:
- Couldn't match expected type ‘IO a0’
- with actual type ‘Char -> IO ()’
- Probable cause: ‘putChar’ is applied to too few arguments
- In the first argument of ‘(>>)’, namely ‘putChar’
- In the expression: putChar >> putChar 'p'
-(deferred type error)
+ +../../typecheck/should_run/Defer01.hs:11:40: warning: + Couldn't match type ‘Char’ with ‘[Char]’ + Expected type: String + Actual type: Char + In the first argument of ‘putStr’, namely ‘','’ + In the second argument of ‘(>>)’, namely ‘putStr ','’ + In the expression: putStr "Hello World" >> putStr ',' + +../../typecheck/should_run/Defer01.hs:14:5: warning: + Couldn't match expected type ‘Int’ with actual type ‘Char’ + In the expression: 'p' + In an equation for ‘a’: a = 'p' + +../../typecheck/should_run/Defer01.hs:18:9: warning: + No instance for (Eq B) arising from a use of ‘==’ + In the expression: x == x + In an equation for ‘b’: b x = x == x + +../../typecheck/should_run/Defer01.hs:25:4: warning: + Couldn't match type ‘Int’ with ‘Bool’ + Inaccessible code in + a pattern with constructor: C2 :: Bool -> C Bool, + in an equation for ‘c’ + In the pattern: C2 x + In an equation for ‘c’: c (C2 x) = True + +../../typecheck/should_run/Defer01.hs:28:5: warning: + No instance for (Num (a -> a)) arising from the literal ‘1’ + (maybe you haven't applied a function to enough arguments?) + In the expression: 1 + In an equation for ‘d’: d = 1 + +../../typecheck/should_run/Defer01.hs:31:5: warning: + Couldn't match expected type ‘Char -> t’ with actual type ‘Char’ + Relevant bindings include + f :: t (bound at ../../typecheck/should_run/Defer01.hs:31:1) + The function ‘e’ is applied to one argument, + but its type ‘Char’ has none + In the expression: e 'q' + In an equation for ‘f’: f = e 'q' + +../../typecheck/should_run/Defer01.hs:34:8: warning: + Couldn't match expected type ‘Char’ with actual type ‘a’ + ‘a’ is a rigid type variable bound by + the type signature for: + h :: a -> (Char, Char) + at ../../typecheck/should_run/Defer01.hs:33:6 + Relevant bindings include + x :: a (bound at ../../typecheck/should_run/Defer01.hs:34:3) + h :: a -> (Char, Char) + (bound at ../../typecheck/should_run/Defer01.hs:34:1) + In the expression: x + In the expression: (x, 'c') + +../../typecheck/should_run/Defer01.hs:39:17: warning: + Couldn't match expected type ‘Bool’ with actual type ‘T a’ + Relevant bindings include + a :: a (bound at ../../typecheck/should_run/Defer01.hs:39:3) + i :: a -> () (bound at ../../typecheck/should_run/Defer01.hs:39:1) + In the first argument of ‘not’, namely ‘(K a)’ + In the expression: (not (K a)) + +../../typecheck/should_run/Defer01.hs:43:5: warning: + No instance for (MyClass a1) arising from a use of ‘myOp’ + In the expression: myOp 23 + In an equation for ‘j’: j = myOp 23 + +../../typecheck/should_run/Defer01.hs:43:10: warning: + No instance for (Num a1) arising from the literal ‘23’ + The type variable ‘a1’ is ambiguous + Potential instances: + instance Num Integer -- Defined in ‘GHC.Num’ + instance Num Double -- Defined in ‘GHC.Float’ + instance Num Float -- Defined in ‘GHC.Float’ + ...plus two others + (use -fprint-potential-instances to see them all) + In the first argument of ‘myOp’, namely ‘23’ + In the expression: myOp 23 + In an equation for ‘j’: j = myOp 23 + +../../typecheck/should_run/Defer01.hs:45:6: warning: + Couldn't match type ‘Int’ with ‘Bool’ + Inaccessible code in + the type signature for: + k :: (Int ~ Bool) => Int -> Bool + In the ambiguity check for the type signature for ‘k’: + k :: (Int ~ Bool) => Int -> Bool + To defer the ambiguity check to use sites, enable AllowAmbiguousTypes + In the type signature for ‘k’: k :: (Int ~ Bool) => Int -> Bool + +../../typecheck/should_run/Defer01.hs:45:6: warning: + Couldn't match expected type ‘Bool’ with actual type ‘Int’ + In the ambiguity check for the type signature for ‘k’: + k :: (Int ~ Bool) => Int -> Bool + To defer the ambiguity check to use sites, enable AllowAmbiguousTypes + In the type signature for ‘k’: k :: (Int ~ Bool) => Int -> Bool + +../../typecheck/should_run/Defer01.hs:45:6: warning: + Couldn't match type ‘Int’ with ‘Bool’ + Inaccessible code in + the type signature for: + k :: (Int ~ Bool) => Int -> Bool + +../../typecheck/should_run/Defer01.hs:46:7: warning: + Couldn't match expected type ‘Bool’ with actual type ‘Int’ + In the expression: x + In an equation for ‘k’: k x = x + +../../typecheck/should_run/Defer01.hs:49:5: warning: + Couldn't match expected type ‘IO a0’ + with actual type ‘Char -> IO ()’ + Probable cause: ‘putChar’ is applied to too few arguments + In the first argument of ‘(>>)’, namely ‘putChar’ + In the expression: putChar >> putChar 'p' +*** Exception: ../../typecheck/should_run/Defer01.hs:11:40: error: + Couldn't match type ‘Char’ with ‘[Char]’ + Expected type: String + Actual type: Char + In the first argument of ‘putStr’, namely ‘','’ + In the second argument of ‘(>>)’, namely ‘putStr ','’ + In the expression: putStr "Hello World" >> putStr ',' +(deferred type error) +*** Exception: ../../typecheck/should_run/Defer01.hs:14:5: error: + Couldn't match expected type ‘Int’ with actual type ‘Char’ + In the expression: 'p' + In an equation for ‘a’: a = 'p' +(deferred type error) +*** Exception: ../../typecheck/should_run/Defer01.hs:18:9: error: + No instance for (Eq B) arising from a use of ‘==’ + In the expression: x == x + In an equation for ‘b’: b x = x == x +(deferred type error) + +<interactive>:7:11: error: + Couldn't match type ‘Bool’ with ‘Int’ + Expected type: C Int + Actual type: C Bool + In the first argument of ‘c’, namely ‘(C2 True)’ + In the first argument of ‘print’, namely ‘(c (C2 True))’ +*** Exception: ../../typecheck/should_run/Defer01.hs:28:5: error: + No instance for (Num (a -> a)) arising from the literal ‘1’ + (maybe you haven't applied a function to enough arguments?) + In the expression: 1 + In an equation for ‘d’: d = 1 +(deferred type error) +*** Exception: ../../typecheck/should_run/Defer01.hs:31:5: error: + Couldn't match expected type ‘Char -> t’ with actual type ‘Char’ + Relevant bindings include + f :: t (bound at ../../typecheck/should_run/Defer01.hs:31:1) + The function ‘e’ is applied to one argument, + but its type ‘Char’ has none + In the expression: e 'q' + In an equation for ‘f’: f = e 'q' +(deferred type error) +*** Exception: ../../typecheck/should_run/Defer01.hs:34:8: error: + Couldn't match expected type ‘Char’ with actual type ‘a’ + ‘a’ is a rigid type variable bound by + the type signature for: + h :: a -> (Char, Char) + at ../../typecheck/should_run/Defer01.hs:33:6 + Relevant bindings include + x :: a (bound at ../../typecheck/should_run/Defer01.hs:34:3) + h :: a -> (Char, Char) + (bound at ../../typecheck/should_run/Defer01.hs:34:1) + In the expression: x + In the expression: (x, 'c') +(deferred type error) +*** Exception: ../../typecheck/should_run/Defer01.hs:39:17: error: + Couldn't match expected type ‘Bool’ with actual type ‘T a’ + Relevant bindings include + a :: a (bound at ../../typecheck/should_run/Defer01.hs:39:3) + i :: a -> () (bound at ../../typecheck/should_run/Defer01.hs:39:1) + In the first argument of ‘not’, namely ‘(K a)’ + In the expression: (not (K a)) +(deferred type error) +*** Exception: ../../typecheck/should_run/Defer01.hs:43:5: error: + No instance for (MyClass a1) arising from a use of ‘myOp’ + In the expression: myOp 23 + In an equation for ‘j’: j = myOp 23 +(deferred type error) + +<interactive>:13:8: error: + Couldn't match expected type ‘Bool’ with actual type ‘Int’ + In the first argument of ‘print’, namely ‘(k 2)’ + In the expression: print (k 2) + In an equation for ‘it’: it = print (k 2) +*** Exception: ../../typecheck/should_run/Defer01.hs:49:5: error: + Couldn't match expected type ‘IO a0’ + with actual type ‘Char -> IO ()’ + Probable cause: ‘putChar’ is applied to too few arguments + In the first argument of ‘(>>)’, namely ‘putChar’ + In the expression: putChar >> putChar 'p' +(deferred type error) diff --git a/testsuite/tests/indexed-types/should_fail/T4485.stderr b/testsuite/tests/indexed-types/should_fail/T4485.stderr index 320d9a5195..f05eeace6e 100644 --- a/testsuite/tests/indexed-types/should_fail/T4485.stderr +++ b/testsuite/tests/indexed-types/should_fail/T4485.stderr @@ -1,5 +1,5 @@ -T4485.hs:50:15: +T4485.hs:50:15: error: Overlapping instances for EmbedAsChild (IdentityT IO) (XMLGenT m0 (XML m0)) arising from a use of ‘asChild’ @@ -18,10 +18,10 @@ T4485.hs:50:15: In an equation for ‘asChild’: asChild b = asChild $ (genElement "foo") -T4485.hs:50:26: +T4485.hs:50:26: error: No instance for (XMLGen m0) arising from a use of ‘genElement’ The type variable ‘m0’ is ambiguous - Note: there is a potential instance available: + Potential instances: instance XMLGen (IdentityT m) -- Defined at T4485.hs:37:10 In the second argument of ‘($)’, namely ‘(genElement "foo")’ In the expression: asChild $ (genElement "foo") diff --git a/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail01.stderr b/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail01.stderr index 52658fdd07..79b78658b3 100644 --- a/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail01.stderr +++ b/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail01.stderr @@ -1,33 +1,35 @@ -
-overloadedlistsfail01.hs:5:8:
- No instance for (Show a0) arising from a use of ‘print’
- The type variable ‘a0’ is ambiguous
- Note: there are several potential instances:
- instance [safe] Show Version -- Defined in ‘Data.Version’
- instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
- instance Show Ordering -- Defined in ‘GHC.Show’
- ...plus 23 others
- In the expression: print [1]
- In an equation for ‘main’: main = print [1]
-
-overloadedlistsfail01.hs:5:14:
- No instance for (IsList a0) arising from an overloaded list
- The type variable ‘a0’ is ambiguous
- Note: there are several potential instances:
- instance IsList Version -- Defined in ‘GHC.Exts’
- instance IsList [a] -- Defined in ‘GHC.Exts’
- In the first argument of ‘print’, namely ‘[1]’
- In the expression: print [1]
- In an equation for ‘main’: main = print [1]
-
-overloadedlistsfail01.hs:5:15:
- No instance for (Num (Item a0)) arising from the literal ‘1’
- The type variable ‘a0’ is ambiguous
- Note: there are several potential instances:
- instance Num Integer -- Defined in ‘GHC.Num’
- instance Num Double -- Defined in ‘GHC.Float’
- instance Num Float -- Defined in ‘GHC.Float’
- ...plus two others
- In the expression: 1
- In the first argument of ‘print’, namely ‘[1]’
- In the expression: print [1]
+ +overloadedlistsfail01.hs:5:8: error: + No instance for (Show a0) arising from a use of ‘print’ + The type variable ‘a0’ is ambiguous + Potential instances: + instance [safe] Show Version -- Defined in ‘Data.Version’ + instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’ + instance Show Ordering -- Defined in ‘GHC.Show’ + ...plus 23 others + (use -fprint-potential-instances to see them all) + In the expression: print [1] + In an equation for ‘main’: main = print [1] + +overloadedlistsfail01.hs:5:14: error: + No instance for (IsList a0) arising from an overloaded list + The type variable ‘a0’ is ambiguous + Potential instances: + instance IsList Version -- Defined in ‘GHC.Exts’ + instance IsList [a] -- Defined in ‘GHC.Exts’ + In the first argument of ‘print’, namely ‘[1]’ + In the expression: print [1] + In an equation for ‘main’: main = print [1] + +overloadedlistsfail01.hs:5:15: error: + No instance for (Num (Item a0)) arising from the literal ‘1’ + The type variable ‘a0’ is ambiguous + Potential instances: + instance Num Integer -- Defined in ‘GHC.Num’ + instance Num Double -- Defined in ‘GHC.Float’ + instance Num Float -- Defined in ‘GHC.Float’ + ...plus two others + (use -fprint-potential-instances to see them all) + In the expression: 1 + In the first argument of ‘print’, namely ‘[1]’ + In the expression: print [1] diff --git a/testsuite/tests/quotes/TH_localname.stderr b/testsuite/tests/quotes/TH_localname.stderr index a83c606eb4..76bfeea8a2 100644 --- a/testsuite/tests/quotes/TH_localname.stderr +++ b/testsuite/tests/quotes/TH_localname.stderr @@ -5,13 +5,14 @@ TH_localname.hs:3:11: error: Relevant bindings include y :: t0 (bound at TH_localname.hs:3:6) x :: t0 -> ExpQ (bound at TH_localname.hs:3:1) - Note: there are several potential instances: + Potential instances: instance (Lift a, Lift b) => Lift (Either a b) -- Defined in ‘Language.Haskell.TH.Syntax’ instance Lift a => Lift (Maybe a) -- Defined in ‘Language.Haskell.TH.Syntax’ instance Lift Int16 -- Defined in ‘Language.Haskell.TH.Syntax’ ...plus 24 others + (use -fprint-potential-instances to see them all) In the expression: lift y In the expression: [| y |] diff --git a/testsuite/tests/rebindable/rebindable6.stderr b/testsuite/tests/rebindable/rebindable6.stderr index 9e3dc0a5c7..b843f33bd7 100644 --- a/testsuite/tests/rebindable/rebindable6.stderr +++ b/testsuite/tests/rebindable/rebindable6.stderr @@ -9,7 +9,7 @@ rebindable6.hs:106:17: error: f :: IO a (bound at rebindable6.hs:104:17) test_do :: IO a -> IO (Maybe b) -> IO b (bound at rebindable6.hs:104:9) - Note: there is a potential instance available: + Potential instances: instance HasSeq (IO a -> IO b -> IO b) -- Defined at rebindable6.hs:52:18 In a stmt of a 'do' block: f @@ -28,7 +28,7 @@ rebindable6.hs:107:17: error: arising from a do statement (maybe you haven't applied a function to enough arguments?) The type variable ‘t1’ is ambiguous - Note: there is a potential instance available: + Potential instances: instance HasFail (String -> IO a) -- Defined at rebindable6.hs:57:18 In a stmt of a 'do' block: Just (b :: b) <- g @@ -52,7 +52,7 @@ rebindable6.hs:108:17: error: g :: IO (Maybe b) (bound at rebindable6.hs:104:19) test_do :: IO a -> IO (Maybe b) -> IO b (bound at rebindable6.hs:104:9) - Note: there is a potential instance available: + Potential instances: instance HasReturn (a -> IO a) -- Defined at rebindable6.hs:42:18 In a stmt of a 'do' block: return b In the expression: diff --git a/testsuite/tests/rename/should_fail/mc14.stderr b/testsuite/tests/rename/should_fail/mc14.stderr index 860d483ffe..3f52be33c6 100644 --- a/testsuite/tests/rename/should_fail/mc14.stderr +++ b/testsuite/tests/rename/should_fail/mc14.stderr @@ -1,14 +1,15 @@ -
-mc14.hs:14:16: error:
- No instance for (Functor t0) arising from a use of ‘fmap’
- The type variable ‘t0’ is ambiguous
- Note: there are several potential instances:
- instance Functor Maybe -- Defined in ‘GHC.Base’
- instance Functor IO -- Defined in ‘GHC.Base’
- instance Functor ((->) r) -- Defined in ‘GHC.Base’
- ...plus two others
- In the expression: fmap
- In a stmt of a monad comprehension: then group using f
- In the expression: [() | f <- functions, then group using f]
-
-mc14.hs:14:49: error: Variable not in scope: f :: [a] -> m (t0 a)
+ +mc14.hs:14:16: error: + No instance for (Functor t0) arising from a use of ‘fmap’ + The type variable ‘t0’ is ambiguous + Potential instances: + instance Functor Maybe -- Defined in ‘GHC.Base’ + instance Functor IO -- Defined in ‘GHC.Base’ + instance Functor ((->) r) -- Defined in ‘GHC.Base’ + ...plus two others + (use -fprint-potential-instances to see them all) + In the expression: fmap + In a stmt of a monad comprehension: then group using f + In the expression: [() | f <- functions, then group using f] + +mc14.hs:14:49: error: Variable not in scope: f :: [a] -> m (t0 a) diff --git a/testsuite/tests/typecheck/should_compile/holes2.stderr b/testsuite/tests/typecheck/should_compile/holes2.stderr index 4ce2e24aa4..392b69992d 100644 --- a/testsuite/tests/typecheck/should_compile/holes2.stderr +++ b/testsuite/tests/typecheck/should_compile/holes2.stderr @@ -1,19 +1,20 @@ -
-holes2.hs:3:5: warning:
- No instance for (Show a0) arising from a use of ‘show’
- The type variable ‘a0’ is ambiguous
- Note: there are several potential instances:
- instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
- instance Show Ordering -- Defined in ‘GHC.Show’
- instance Show Integer -- Defined in ‘GHC.Show’
- ...plus 22 others
- In the expression: show _
- In an equation for ‘f’: f = show _
-
-holes2.hs:3:10: warning:
- Found hole: _ :: a0
- Where: ‘a0’ is an ambiguous type variable
- Relevant bindings include f :: String (bound at holes2.hs:3:1)
- In the first argument of ‘show’, namely ‘_’
- In the expression: show _
- In an equation for ‘f’: f = show _
+ +holes2.hs:3:5: warning: + No instance for (Show a0) arising from a use of ‘show’ + The type variable ‘a0’ is ambiguous + Potential instances: + instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’ + instance Show Ordering -- Defined in ‘GHC.Show’ + instance Show Integer -- Defined in ‘GHC.Show’ + ...plus 22 others + (use -fprint-potential-instances to see them all) + In the expression: show _ + In an equation for ‘f’: f = show _ + +holes2.hs:3:10: warning: + Found hole: _ :: a0 + Where: ‘a0’ is an ambiguous type variable + Relevant bindings include f :: String (bound at holes2.hs:3:1) + In the first argument of ‘show’, namely ‘_’ + In the expression: show _ + In an equation for ‘f’: f = show _ diff --git a/testsuite/tests/typecheck/should_fail/T4921.stderr b/testsuite/tests/typecheck/should_fail/T4921.stderr index a7267a26d3..091d461328 100644 --- a/testsuite/tests/typecheck/should_fail/T4921.stderr +++ b/testsuite/tests/typecheck/should_fail/T4921.stderr @@ -1,19 +1,19 @@ -
-T4921.hs:10:9:
- No instance for (C a0 b1) arising from a use of ‘f’
- The type variables ‘b1’, ‘a0’ are ambiguous
- Relevant bindings include x :: a0 (bound at T4921.hs:10:1)
- Note: there is a potential instance available:
- instance C Int Char -- Defined at T4921.hs:7:10
- In the first argument of ‘fst’, namely ‘f’
- In the expression: fst f
- In an equation for ‘x’: x = fst f
-
-T4921.hs:12:9:
- No instance for (C Int b0) arising from a use of ‘f’
- The type variable ‘b0’ is ambiguous
- Note: there is a potential instance available:
- instance C Int Char -- Defined at T4921.hs:7:10
- In the first argument of ‘fst’, namely ‘f’
- In the expression: fst f :: Int
- In an equation for ‘y’: y = fst f :: Int
+ +T4921.hs:10:9: error: + No instance for (C a0 b1) arising from a use of ‘f’ + The type variables ‘b1’, ‘a0’ are ambiguous + Relevant bindings include x :: a0 (bound at T4921.hs:10:1) + Potential instances: + instance C Int Char -- Defined at T4921.hs:7:10 + In the first argument of ‘fst’, namely ‘f’ + In the expression: fst f + In an equation for ‘x’: x = fst f + +T4921.hs:12:9: error: + No instance for (C Int b0) arising from a use of ‘f’ + The type variable ‘b0’ is ambiguous + Potential instances: + instance C Int Char -- Defined at T4921.hs:7:10 + In the first argument of ‘fst’, namely ‘f’ + In the expression: fst f :: Int + In an equation for ‘y’: y = fst f :: Int diff --git a/testsuite/tests/typecheck/should_fail/T5095.stderr b/testsuite/tests/typecheck/should_fail/T5095.stderr index 0cf88546a0..46667fb8f4 100644 --- a/testsuite/tests/typecheck/should_fail/T5095.stderr +++ b/testsuite/tests/typecheck/should_fail/T5095.stderr @@ -1,82 +1,14 @@ -T5095.hs:9:11: +T5095.hs:9:11: error: Overlapping instances for Eq a arising from a use of ‘==’ Matching instances: instance [overlappable] Show a => Eq a -- Defined at T5095.hs:5:31 - instance Eq a => Eq (Maybe a) -- Defined in ‘GHC.Base’ - instance Eq () -- Defined in ‘GHC.Classes’ - instance (Eq a, Eq b) => Eq (a, b) -- Defined in ‘GHC.Classes’ - instance (Eq a, Eq b, Eq c) => Eq (a, b, c) - -- Defined in ‘GHC.Classes’ - instance (Eq a, Eq b, Eq c, Eq d) => Eq (a, b, c, d) - -- Defined in ‘GHC.Classes’ - instance (Eq a, Eq b, Eq c, Eq d, Eq e) => Eq (a, b, c, d, e) - -- Defined in ‘GHC.Classes’ - instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f) => - Eq (a, b, c, d, e, f) - -- Defined in ‘GHC.Classes’ - instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g) => - Eq (a, b, c, d, e, f, g) - -- Defined in ‘GHC.Classes’ - instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h) => - Eq (a, b, c, d, e, f, g, h) - -- Defined in ‘GHC.Classes’ - instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i) => - Eq (a, b, c, d, e, f, g, h, i) - -- Defined in ‘GHC.Classes’ - instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, - Eq j) => - Eq (a, b, c, d, e, f, g, h, i, j) - -- Defined in ‘GHC.Classes’ - instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, - Eq j, Eq k) => - Eq (a, b, c, d, e, f, g, h, i, j, k) - -- Defined in ‘GHC.Classes’ - instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, - Eq j, Eq k, Eq l) => - Eq (a, b, c, d, e, f, g, h, i, j, k, l) - -- Defined in ‘GHC.Classes’ - instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, - Eq j, Eq k, Eq l, Eq m) => - Eq (a, b, c, d, e, f, g, h, i, j, k, l, m) - -- Defined in ‘GHC.Classes’ - instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, - Eq j, Eq k, Eq l, Eq m, Eq n) => - Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n) - -- Defined in ‘GHC.Classes’ - instance (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, - Eq j, Eq k, Eq l, Eq m, Eq n, Eq o) => - Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) - -- Defined in ‘GHC.Classes’ - instance Eq Bool -- Defined in ‘GHC.Classes’ - instance Eq Char -- Defined in ‘GHC.Classes’ - instance Eq Double -- Defined in ‘GHC.Classes’ - instance Eq Float -- Defined in ‘GHC.Classes’ - instance Eq Int -- Defined in ‘GHC.Classes’ - instance Eq Ordering -- Defined in ‘GHC.Classes’ - instance Eq Word -- Defined in ‘GHC.Classes’ - instance Eq a => Eq [a] -- Defined in ‘GHC.Classes’ - instance Eq integer-gmp-1.0.0.0:GHC.Integer.Type.BigNat - -- Defined in ‘integer-gmp-1.0.0.0:GHC.Integer.Type’ - instance Eq Integer - -- Defined in ‘integer-gmp-1.0.0.0:GHC.Integer.Type’ - instance Eq All -- Defined in ‘Data.Monoid’ - instance forall (k :: BOX) (f :: k -> *) (a :: k). - Eq (f a) => - Eq (Alt f a) - -- Defined in ‘Data.Monoid’ - instance Eq Any -- Defined in ‘Data.Monoid’ - instance Eq a => Eq (Dual a) -- Defined in ‘Data.Monoid’ - instance Eq a => Eq (First a) -- Defined in ‘Data.Monoid’ - instance Eq a => Eq (Last a) -- Defined in ‘Data.Monoid’ - instance Eq a => Eq (Product a) -- Defined in ‘Data.Monoid’ - instance Eq a => Eq (Sum a) -- Defined in ‘Data.Monoid’ - instance forall (k :: BOX) (s :: k). Eq (Proxy s) - -- Defined in ‘Data.Proxy’ instance (Eq a, Eq b) => Eq (Either a b) -- Defined in ‘Data.Either’ - instance (Ix i, Eq e) => Eq (Array i e) -- Defined in ‘GHC.Arr’ - instance Eq (STArray s i e) -- Defined in ‘GHC.Arr’ + instance Eq All -- Defined in ‘Data.Monoid’ + ...plus 35 others + ...plus one instance involving out-of-scope types + (use -fprint-potential-instances to see them all) (The choice depends on the instantiation of ‘a’ To pick the first instance above, use IncoherentInstances when compiling the other instance declarations) diff --git a/testsuite/tests/typecheck/should_fail/T5858.stderr b/testsuite/tests/typecheck/should_fail/T5858.stderr index 1378bae9c2..9c381d9bf6 100644 --- a/testsuite/tests/typecheck/should_fail/T5858.stderr +++ b/testsuite/tests/typecheck/should_fail/T5858.stderr @@ -1,9 +1,9 @@ -T5858.hs:11:7: +T5858.hs:11:7: error: No instance for (InferOverloaded ([t0], [t1])) arising from a use of ‘infer’ The type variables ‘t0’, ‘t1’ are ambiguous - Note: there is a potential instance available: + Potential instances: instance (t1 ~ String) => InferOverloaded (t1, t1) -- Defined at T5858.hs:8:10 In the expression: infer ([], []) diff --git a/testsuite/tests/typecheck/should_fail/T7857.stderr b/testsuite/tests/typecheck/should_fail/T7857.stderr index bc8fed9bf2..f413eb50f2 100644 --- a/testsuite/tests/typecheck/should_fail/T7857.stderr +++ b/testsuite/tests/typecheck/should_fail/T7857.stderr @@ -1,11 +1,11 @@ -T7857.hs:8:11: +T7857.hs:8:11: error: Could not deduce (PrintfType r0) arising from a use of ‘printf’ from the context: PrintfArg t bound by the inferred type of g :: PrintfArg t => t -> b at T7857.hs:8:1-21 The type variable ‘r0’ is ambiguous - Note: there are several potential instances: + Potential instances: instance [safe] (a ~ ()) => PrintfType (IO a) -- Defined in ‘Text.Printf’ instance [safe] (PrintfArg a, PrintfType r) => PrintfType (a -> r) diff --git a/testsuite/tests/typecheck/should_fail/tcfail008.stderr b/testsuite/tests/typecheck/should_fail/tcfail008.stderr index 2fc79b2220..db70a632f4 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail008.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail008.stderr @@ -1,18 +1,19 @@ -tcfail008.hs:3:5: +tcfail008.hs:3:5: error: No instance for (Num a0) arising from the literal ‘1’ The type variable ‘a0’ is ambiguous Relevant bindings include o :: [a0] (bound at tcfail008.hs:3:1) - Note: there are several potential instances: + Potential instances: instance Num Integer -- Defined in ‘GHC.Num’ instance Num Double -- Defined in ‘GHC.Float’ instance Num Float -- Defined in ‘GHC.Float’ ...plus two others + (use -fprint-potential-instances to see them all) In the first argument of ‘(:)’, namely ‘1’ In the expression: 1 : 2 In an equation for ‘o’: o = 1 : 2 -tcfail008.hs:3:7: +tcfail008.hs:3:7: error: No instance for (Num [a0]) arising from the literal ‘2’ In the second argument of ‘(:)’, namely ‘2’ In the expression: 1 : 2 diff --git a/testsuite/tests/typecheck/should_fail/tcfail040.stderr b/testsuite/tests/typecheck/should_fail/tcfail040.stderr index 923be56470..68e958ecab 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail040.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail040.stderr @@ -1,8 +1,8 @@ -tcfail040.hs:19:5: +tcfail040.hs:19:5: error: No instance for (ORD a0) arising from a use of ‘<<’ The type variable ‘a0’ is ambiguous - Note: there is a potential instance available: + Potential instances: instance ORD (a -> b) -- Defined at tcfail040.hs:17:10 In the first argument of ‘(===)’, namely ‘(<<)’ In the expression: (<<) === (<<) diff --git a/testsuite/tests/typecheck/should_fail/tcfail043.stderr b/testsuite/tests/typecheck/should_fail/tcfail043.stderr index a058d87ff8..fe24adc4e4 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail043.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail043.stderr @@ -1,12 +1,12 @@ -tcfail043.hs:38:17: +tcfail043.hs:38:17: error: No instance for (Ord_ a0) arising from a use of ‘gt’ The type variable ‘a0’ is ambiguous Relevant bindings include bs :: [a0] (bound at tcfail043.hs:38:8) a :: a0 (bound at tcfail043.hs:38:6) search :: a0 -> [a0] -> Bool (bound at tcfail043.hs:37:1) - Note: there is a potential instance available: + Potential instances: instance Ord_ Int -- Defined at tcfail043.hs:34:10 In the expression: gt (hd bs) a In the expression: @@ -21,14 +21,14 @@ tcfail043.hs:38:17: else if eq a (hd bs) then True else search a (tl bs) -tcfail043.hs:40:25: +tcfail043.hs:40:25: error: No instance for (Eq_ a0) arising from a use of ‘eq’ The type variable ‘a0’ is ambiguous Relevant bindings include bs :: [a0] (bound at tcfail043.hs:38:8) a :: a0 (bound at tcfail043.hs:38:6) search :: a0 -> [a0] -> Bool (bound at tcfail043.hs:37:1) - Note: there are several potential instances: + Potential instances: instance Eq_ Int -- Defined at tcfail043.hs:20:10 instance Eq_ a => Eq_ [a] -- Defined at tcfail043.hs:23:10 In the expression: eq a (hd bs) diff --git a/testsuite/tests/typecheck/should_fail/tcfail072.stderr b/testsuite/tests/typecheck/should_fail/tcfail072.stderr index c08bb58fb1..f3386f164b 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail072.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail072.stderr @@ -1,16 +1,18 @@ -tcfail072.hs:23:13: +tcfail072.hs:23:13: error: Could not deduce (Ord p0) arising from a use of ‘g’ from the context: (Ord p, Ord q) bound by the type signature for: - g :: (Ord p, Ord q) => AB p q -> Bool + g :: (Ord p, Ord q) => AB p q -> Bool at tcfail072.hs:22:6-38 The type variable ‘p0’ is ambiguous - Note: there are several potential instances: + Potential instances: instance Ord a => Ord (Maybe a) -- Defined in ‘GHC.Base’ instance Ord Ordering -- Defined in ‘GHC.Classes’ - instance Ord integer-gmp-1.0.0.0:GHC.Integer.Type.BigNat + instance Ord Integer -- Defined in ‘integer-gmp-1.0.0.0:GHC.Integer.Type’ - ...plus 23 others + ...plus 22 others + ...plus one instance involving out-of-scope types + (use -fprint-potential-instances to see them all) In the expression: g A In an equation for ‘g’: g (B _ _) = g A diff --git a/testsuite/tests/typecheck/should_fail/tcfail128.stderr b/testsuite/tests/typecheck/should_fail/tcfail128.stderr index 6d59560c82..4ad7273c0b 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail128.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail128.stderr @@ -1,9 +1,9 @@ -tcfail128.hs:18:16: +tcfail128.hs:18:16: error: No instance for (Data.Array.Base.MArray b0 FlatVector IO) arising from a use of ‘thaw’ The type variable ‘b0’ is ambiguous - Note: there is a potential instance available: + Potential instances: instance Data.Array.Base.MArray IOArray e IO -- Defined in ‘Data.Array.Base’ In a stmt of a 'do' block: v <- thaw tmp diff --git a/testsuite/tests/typecheck/should_fail/tcfail133.stderr b/testsuite/tests/typecheck/should_fail/tcfail133.stderr index dc9c96d2db..1869cea44b 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail133.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail133.stderr @@ -1,21 +1,22 @@ -tcfail133.hs:2:61: Warning: +tcfail133.hs:2:61: warning: -XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language. -tcfail133.hs:68:7: +tcfail133.hs:68:7: error: No instance for (Show r0) arising from a use of ‘show’ The type variable ‘r0’ is ambiguous - Note: there are several potential instances: + Potential instances: instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’ instance Show Ordering -- Defined in ‘GHC.Show’ instance Show Integer -- Defined in ‘GHC.Show’ ...plus 25 others + (use -fprint-potential-instances to see them all) In the expression: show In the expression: show $ add (One :@ Zero) (One :@ One) In an equation for ‘foo’: foo = show $ add (One :@ Zero) (One :@ One) -tcfail133.hs:68:14: +tcfail133.hs:68:14: error: No instance for (AddDigit (Zero :@ (One :@ One)) One r0) arising from a use of ‘add’ In the second argument of ‘($)’, namely diff --git a/testsuite/tests/typecheck/should_fail/tcfail181.stderr b/testsuite/tests/typecheck/should_fail/tcfail181.stderr index 787b62e330..3d3507f256 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail181.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail181.stderr @@ -1,16 +1,17 @@ -tcfail181.hs:17:9: +tcfail181.hs:17:9: error: Could not deduce (Monad m0) arising from a use of ‘foo’ from the context: Monad m bound by the inferred type of wog :: Monad m => t -> Something (m Bool) e at tcfail181.hs:17:1-30 The type variable ‘m0’ is ambiguous - Note: there are several potential instances: + Potential instances: instance Monad Maybe -- Defined in ‘GHC.Base’ instance Monad IO -- Defined in ‘GHC.Base’ instance Monad ((->) r) -- Defined in ‘GHC.Base’ ...plus two others + (use -fprint-potential-instances to see them all) In the expression: foo In the expression: foo {bar = return True} In an equation for ‘wog’: wog x = foo {bar = return True} |