summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsheaf <sam.derbyshire@gmail.com>2021-11-19 10:19:19 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-11-20 18:13:23 -0500
commit742d8b6049c30f3b0cd1704d7a34d865bef41712 (patch)
treeb22ad862ca4db2e9004d8b4ab4aafbc11bcde0a9
parentbc7e9f038112496c45aeb81d1504e57acb3722c7 (diff)
downloadhaskell-742d8b6049c30f3b0cd1704d7a34d865bef41712.tar.gz
Include "not more specific" info in overlap msg
When instances overlap, we now include additional information about why we weren't able to select an instance: perhaps one instance overlapped another but was not strictly more specific, so we aren't able to directly choose it. Fixes #20542
-rw-r--r--compiler/GHC/Builtin/Names.hs2
-rw-r--r--compiler/GHC/Tc/Errors.hs196
-rw-r--r--testsuite/tests/ado/T13242a.stderr7
-rw-r--r--testsuite/tests/annotations/should_fail/annfail10.stderr15
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break006.stderr14
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print019.stderr7
-rw-r--r--testsuite/tests/ghci/scripts/T10963.stderr7
-rw-r--r--testsuite/tests/ghci/scripts/T15325.stderr5
-rw-r--r--testsuite/tests/indexed-types/should_fail/T12522a.stderr7
-rw-r--r--testsuite/tests/indexed-types/should_fail/T20466.stderr20
-rw-r--r--testsuite/tests/indexed-types/should_fail/T4485.stderr5
-rw-r--r--testsuite/tests/overloadedlists/should_fail/overloadedlistsfail01.stderr16
-rw-r--r--testsuite/tests/parser/should_fail/RecordDotSyntaxFail11.stderr7
-rw-r--r--testsuite/tests/parser/should_fail/RecordDotSyntaxFail8.stderr7
-rw-r--r--testsuite/tests/partial-sigs/should_fail/T10999.stderr7
-rw-r--r--testsuite/tests/polykinds/T13393.stderr7
-rw-r--r--testsuite/tests/quotes/TH_localname.stderr2
-rw-r--r--testsuite/tests/rebindable/rebindable6.stderr6
-rw-r--r--testsuite/tests/typecheck/should_compile/T14273.stderr14
-rw-r--r--testsuite/tests/typecheck/should_compile/holes2.stderr7
-rw-r--r--testsuite/tests/typecheck/should_fail/FailDueToGivenOverlapping.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/T10971b.stderr28
-rw-r--r--testsuite/tests/typecheck/should_fail/T12921.stderr12
-rw-r--r--testsuite/tests/typecheck/should_fail/T13292.stderr5
-rw-r--r--testsuite/tests/typecheck/should_fail/T14884.stderr7
-rw-r--r--testsuite/tests/typecheck/should_fail/T15883b.stderr5
-rw-r--r--testsuite/tests/typecheck/should_fail/T15883c.stderr10
-rw-r--r--testsuite/tests/typecheck/should_fail/T15883d.stderr5
-rw-r--r--testsuite/tests/typecheck/should_fail/T15883e.stderr10
-rw-r--r--testsuite/tests/typecheck/should_fail/T16414.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/T20122.stderr5
-rw-r--r--testsuite/tests/typecheck/should_fail/T20542.hs17
-rw-r--r--testsuite/tests/typecheck/should_fail/T20542.stderr15
-rw-r--r--testsuite/tests/typecheck/should_fail/T4921.stderr4
-rw-r--r--testsuite/tests/typecheck/should_fail/T5095.stderr7
-rw-r--r--testsuite/tests/typecheck/should_fail/T5858.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/T7857.stderr6
-rw-r--r--testsuite/tests/typecheck/should_fail/TyAppPat_PatternBindingExistential.stderr7
-rw-r--r--testsuite/tests/typecheck/should_fail/all.T1
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail008.stderr5
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail040.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail043.stderr4
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail072.stderr7
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail121.stderr23
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail128.stderr5
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail133.stderr7
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail181.stderr5
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail218.stderr3
48 files changed, 337 insertions, 232 deletions
diff --git a/compiler/GHC/Builtin/Names.hs b/compiler/GHC/Builtin/Names.hs
index c051f1c559..a1cb4fbcb5 100644
--- a/compiler/GHC/Builtin/Names.hs
+++ b/compiler/GHC/Builtin/Names.hs
@@ -2757,7 +2757,7 @@ Situations in which we apply this special logic:
class Cls a
because BoxedRep/Lifted were not in scope.
- See GHC.Tc.Errors.pprPotentials.
+ See GHC.Tc.Errors.potentialInstancesErrMsg.
This fixes one of the issues reported in #20465.
-}
diff --git a/compiler/GHC/Tc/Errors.hs b/compiler/GHC/Tc/Errors.hs
index 6a6ccecf20..0d84dddb1e 100644
--- a/compiler/GHC/Tc/Errors.hs
+++ b/compiler/GHC/Tc/Errors.hs
@@ -1,5 +1,6 @@
{-# LANGUAGE LambdaCase #-}
+{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
@@ -85,7 +86,9 @@ import Control.Monad ( unless, when, foldM, forM_ )
import Data.Foldable ( toList )
import Data.Functor ( (<&>) )
import Data.Function ( on )
-import Data.List ( partition, mapAccumL, sortBy, unfoldr )
+import Data.List ( groupBy, partition, mapAccumL
+ , sortBy, tails, unfoldr )
+import Data.Ord ( comparing )
-- import Data.Semigroup ( Semigroup )
import qualified Data.Semigroup as Semigroup
@@ -2615,16 +2618,13 @@ mk_dict_err ctxt@(CEC {cec_encl = implics}) (ct, (matches, unifiers, unsafe_over
potential_msg
= ppWhen (not (null unifiers) && want_potential orig) $
- sdocOption sdocPrintPotentialInstances $ \print_insts ->
- getPprStyle $ \sty ->
- pprPotentials (PrintPotentialInstances print_insts) sty potential_hdr unifiers
+ potential_hdr $$
+ potentialInstancesErrMsg (PotentialInstances { matches = [], unifiers })
potential_hdr
- = vcat [ ppWhen lead_with_ambig $
- text "Probable fix: use a type annotation to specify what"
- <+> pprQuotedList ambig_tvs <+> text "should be."
- , thisOrThese unifiers <+> text "potential instance" <> plural unifiers
- <+> text "exist" <> singular unifiers <> text ":"]
+ = ppWhen lead_with_ambig $
+ text "Probable fix: use a type annotation to specify what"
+ <+> pprQuotedList ambig_tvs <+> text "should be."
mb_patsyn_prov :: Maybe SDoc
mb_patsyn_prov
@@ -2676,10 +2676,8 @@ mk_dict_err ctxt@(CEC {cec_encl = implics}) (ct, (matches, unifiers, unsafe_over
sep [text "Matching givens (or their superclasses):"
, nest 2 (vcat matching_givens)]
- , sdocOption sdocPrintPotentialInstances $ \print_insts ->
- getPprStyle $ \sty ->
- pprPotentials (PrintPotentialInstances print_insts) sty (text "Matching instances:") $
- ispecs ++ unifiers
+ , potentialInstancesErrMsg
+ (PotentialInstances { matches = map fst matches, unifiers })
, ppWhen (null matching_givens && isSingleton matches && null unifiers) $
-- Intuitively, some given matched the wanted in their
@@ -2907,36 +2905,88 @@ show_fixes (f:fs) = sep [ text "Possible fix:"
, nest 2 (vcat (f : map (text "or" <+>) fs))]
--- Avoid boolean blindness
-newtype PrintPotentialInstances = PrintPotentialInstances Bool
-
-pprPotentials :: PrintPotentialInstances -> PprStyle -> SDoc -> [ClsInst] -> SDoc
+-- | This datatype collates instances that match or unifier,
+-- in order to report an error message for an unsolved typeclass constraint.
+data PotentialInstances
+ = PotentialInstances
+ { matches :: [ClsInst]
+ , unifiers :: [ClsInst]
+ }
+
+-- | Directly display the given matching and unifying instances,
+-- with a header for each: `Matching instances`/`Potentially matching instances`.
+pprPotentialInstances :: (ClsInst -> SDoc) -> PotentialInstances -> SDoc
+pprPotentialInstances ppr_inst (PotentialInstances { matches, unifiers }) =
+ vcat
+ [ ppWhen (not $ null matches) $
+ text "Matching instance" <> plural matches <> colon $$
+ nest 2 (vcat (map ppr_inst matches))
+ , ppWhen (not $ null unifiers) $
+ (text "Potentially matching instance" <> plural unifiers <> colon) $$
+ nest 2 (vcat (map ppr_inst unifiers))
+ ]
+
+-- | Display a summary of available instances, omitting those involving
+-- out-of-scope types, in order to explain why we couldn't solve a particular
+-- constraint, e.g. due to instance overlap or out-of-scope types.
+--
+-- To directly display a collection of matching/unifying instances,
+-- use 'pprPotentialInstances'.
+potentialInstancesErrMsg :: PotentialInstances -> SDoc
-- See Note [Displaying potential instances]
-pprPotentials (PrintPotentialInstances show_potentials) sty herald insts
- | null insts
+potentialInstancesErrMsg potentials =
+ sdocOption sdocPrintPotentialInstances $ \print_insts ->
+ getPprStyle $ \sty ->
+ potentials_msg_with_options potentials print_insts sty
+
+-- | Display a summary of available instances, omitting out-of-scope ones.
+--
+-- Use 'potentialInstancesErrMsg' to automatically set the pretty-printing
+-- options.
+potentials_msg_with_options :: PotentialInstances
+ -> Bool -- ^ Whether to print /all/ potential instances
+ -> PprStyle
+ -> SDoc
+potentials_msg_with_options
+ (PotentialInstances { matches, unifiers })
+ show_all_potentials sty
+ | null matches && null unifiers
= empty
- | null show_these
- = hang herald
- 2 (vcat [ not_in_scope_msg empty
- , flag_hint ])
+ | null show_these_matches && null show_these_unifiers
+ = vcat [ not_in_scope_msg empty
+ , flag_hint ]
| otherwise
- = hang herald
- 2 (vcat [ pprInstances show_these
- , ppWhen (n_in_scope_hidden > 0) $
- text "...plus"
- <+> speakNOf n_in_scope_hidden (text "other")
- , not_in_scope_msg (text "...plus")
- , flag_hint ])
+ = vcat [ pprPotentialInstances
+ pprInstance -- print instance + location info
+ (PotentialInstances
+ { matches = show_these_matches
+ , unifiers = show_these_unifiers })
+ , overlapping_but_not_more_specific_msg sorted_matches
+ , nest 2 $ vcat
+ [ ppWhen (n_in_scope_hidden > 0) $
+ text "...plus"
+ <+> speakNOf n_in_scope_hidden (text "other")
+ , ppWhen (not_in_scopes > 0) $
+ not_in_scope_msg (text "...plus")
+ , flag_hint ] ]
where
- n_show = 3 :: Int
-
- (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
+ n_show_matches, n_show_unifiers :: Int
+ n_show_matches = 3
+ n_show_unifiers = 2
+
+ (in_scope_matches, not_in_scope_matches) = partition inst_in_scope matches
+ (in_scope_unifiers, not_in_scope_unifiers) = partition inst_in_scope unifiers
+ sorted_matches = sortBy fuzzyClsInstCmp in_scope_matches
+ sorted_unifiers = sortBy fuzzyClsInstCmp in_scope_unifiers
+ (show_these_matches, show_these_unifiers)
+ | show_all_potentials = (sorted_matches, sorted_unifiers)
+ | otherwise = (take n_show_matches sorted_matches
+ ,take n_show_unifiers sorted_unifiers)
+ n_in_scope_hidden
+ = length sorted_matches + length sorted_unifiers
+ - length show_these_matches - length show_these_unifiers
-- "in scope" means that all the type constructors
-- are lexically in scope; these instances are likely
@@ -2958,17 +3008,73 @@ pprPotentials (PrintPotentialInstances show_potentials) sty herald insts
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) (text "instance")
- <+> text "involving out-of-scope types")
- 2 (ppWhen show_potentials (pprInstances not_in_scope))
+ not_in_scopes :: Int
+ not_in_scopes = length not_in_scope_matches + length not_in_scope_unifiers
- flag_hint = ppUnless (show_potentials || equalLength show_these insts) $
+ not_in_scope_msg herald =
+ hang (herald <+> speakNOf not_in_scopes (text "instance")
+ <+> text "involving out-of-scope types")
+ 2 (ppWhen show_all_potentials $
+ pprPotentialInstances
+ pprInstanceHdr -- only print the header, not the instance location info
+ (PotentialInstances
+ { matches = not_in_scope_matches
+ , unifiers = not_in_scope_unifiers
+ }))
+
+ flag_hint = ppUnless (show_all_potentials
+ || (equalLength show_these_matches matches
+ && equalLength show_these_unifiers unifiers)) $
text "(use -fprint-potential-instances to see them all)"
+-- | Compute a message informing the user of any instances that are overlapped
+-- but were not discarded because the instance overlapping them wasn't
+-- strictly more specific.
+overlapping_but_not_more_specific_msg :: [ClsInst] -> SDoc
+overlapping_but_not_more_specific_msg insts
+ -- Only print one example of "overlapping but not strictly more specific",
+ -- to avoid information overload.
+ | overlap : _ <- overlapping_but_not_more_specific
+ = overlap_header $$ ppr_overlapping overlap
+ | otherwise
+ = empty
+ where
+ overlap_header :: SDoc
+ overlap_header
+ | [_] <- overlapping_but_not_more_specific
+ = text "An overlapping instance can only be chosen when it is strictly more specific."
+ | otherwise
+ = text "Overlapping instances can only be chosen when they are strictly more specific."
+ overlapping_but_not_more_specific :: [(ClsInst, ClsInst)]
+ overlapping_but_not_more_specific
+ = nubOrdBy (comparing (is_dfun . fst))
+ [ (overlapper, overlappee)
+ | these <- groupBy ((==) `on` is_cls_nm) insts
+ -- Take all pairs of distinct instances...
+ , one:others <- tails these -- if `these = [inst_1, inst_2, ...]`
+ , other <- others -- then we get pairs `(one, other) = (inst_i, inst_j)` with `i < j`
+ -- ... such that one instance in the pair overlaps the other...
+ , let mb_overlapping
+ | hasOverlappingFlag (overlapMode $ is_flag one)
+ || hasOverlappableFlag (overlapMode $ is_flag other)
+ = [(one, other)]
+ | hasOverlappingFlag (overlapMode $ is_flag other)
+ || hasOverlappableFlag (overlapMode $ is_flag one)
+ = [(other, one)]
+ | otherwise
+ = []
+ , (overlapper, overlappee) <- mb_overlapping
+ -- ... but the overlapper is not more specific than the overlappee.
+ , not (overlapper `more_specific_than` overlappee)
+ ]
+ more_specific_than :: ClsInst -> ClsInst -> Bool
+ is1 `more_specific_than` is2
+ = isJust (tcMatchTys (is_tys is1) (is_tys is2))
+ ppr_overlapping :: (ClsInst, ClsInst) -> SDoc
+ ppr_overlapping (overlapper, overlappee)
+ = text "The first instance that follows overlaps the second, but is not more specific than it:"
+ $$ nest 2 (vcat $ map pprInstanceHdr [overlapper, overlappee])
+
{- Note [Displaying potential instances]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When showing a list of instances for
diff --git a/testsuite/tests/ado/T13242a.stderr b/testsuite/tests/ado/T13242a.stderr
index 4ada4ecaed..08b643cd10 100644
--- a/testsuite/tests/ado/T13242a.stderr
+++ b/testsuite/tests/ado/T13242a.stderr
@@ -25,12 +25,11 @@ T13242a.hs:13:13: error:
prevents the constraint ‘(Eq a0)’ from being solved.
Relevant bindings include x :: a0 (bound at T13242a.hs:10:5)
Probable fix: use a type annotation to specify what ‘a0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance Eq Ordering -- Defined in ‘GHC.Classes’
instance Eq Integer -- Defined in ‘GHC.Num.Integer’
- instance Eq () -- Defined in ‘GHC.Classes’
- ...plus N others
- ...plus N instances involving out-of-scope types
+ ...plus 23 others
+ ...plus five instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In a stmt of a 'do' block: return (x == x)
In the expression:
diff --git a/testsuite/tests/annotations/should_fail/annfail10.stderr b/testsuite/tests/annotations/should_fail/annfail10.stderr
index bd28fb4b17..fae9f514ff 100644
--- a/testsuite/tests/annotations/should_fail/annfail10.stderr
+++ b/testsuite/tests/annotations/should_fail/annfail10.stderr
@@ -3,15 +3,13 @@ annfail10.hs:9:1: error:
• Ambiguous type variable ‘a0’ arising from an annotation
prevents the constraint ‘(Data.Data.Data a0)’ from being solved.
Probable fix: use a type annotation to specify what ‘a0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance (Data.Data.Data a, Data.Data.Data b) =>
Data.Data.Data (Either a b)
-- Defined in ‘Data.Data’
instance Data.Data.Data Ordering -- Defined in ‘Data.Data’
- instance Data.Data.Data a => Data.Data.Data (Maybe a)
- -- Defined in ‘Data.Data’
- ...plus N others
- ...plus N instances involving out-of-scope types
+ ...plus 17 others
+ ...plus 50 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the annotation: {-# ANN f 1 #-}
@@ -19,11 +17,10 @@ annfail10.hs:9:11: error:
• Ambiguous type variable ‘a0’ arising from the literal ‘1’
prevents the constraint ‘(Num a0)’ from being solved.
Probable fix: use a type annotation to specify what ‘a0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance Num Integer -- Defined in ‘GHC.Num’
instance Num Double -- Defined in ‘GHC.Float’
- instance Num Float -- Defined in ‘GHC.Float’
- ...plus N others
- ...plus N instances involving out-of-scope types
+ ...plus three others
+ ...plus 19 instances involving out-of-scope types
(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 198bc0df49..aff21f46ab 100644
--- a/testsuite/tests/ghci.debugger/scripts/break006.stderr
+++ b/testsuite/tests/ghci.debugger/scripts/break006.stderr
@@ -4,12 +4,11 @@
Cannot resolve unknown runtime type ‘a’
Use :print or :force to determine these types
Relevant bindings include it :: a (bound at <interactive>:4:1)
- These potential instances exist:
+ Potentially matching instances:
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
- instance Show Integer -- Defined in ‘GHC.Show’
- ...plus N others
- ...plus N instances involving out-of-scope types
+ ...plus 25 others
+ ...plus 12 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In a stmt of an interactive GHCi command: print it
@@ -18,11 +17,10 @@
Cannot resolve unknown runtime type ‘a’
Use :print or :force to determine these types
Relevant bindings include it :: a (bound at <interactive>:6:1)
- These potential instances exist:
+ Potentially matching instances:
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
- instance Show Integer -- Defined in ‘GHC.Show’
- ...plus N others
- ...plus N instances involving out-of-scope types
+ ...plus 25 others
+ ...plus 12 instances involving out-of-scope types
(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 09b1bfbd8c..3833768d40 100644
--- a/testsuite/tests/ghci.debugger/scripts/print019.stderr
+++ b/testsuite/tests/ghci.debugger/scripts/print019.stderr
@@ -4,11 +4,10 @@
Cannot resolve unknown runtime type ‘a1’
Use :print or :force to determine these types
Relevant bindings include it :: a1 (bound at <interactive>:10:1)
- These potential instances exist:
+ Potentially matching instances:
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show TyCon -- Defined in ‘GHC.Show’
- instance Show a => Show (List1 a) -- Defined at Test.hs:11:12
- ...plus N others
- ...plus N instances involving out-of-scope types
+ ...plus 32 others
+ ...plus 13 instances involving out-of-scope types
(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/T10963.stderr b/testsuite/tests/ghci/scripts/T10963.stderr
index 7082d6e6cf..23b18b29cc 100644
--- a/testsuite/tests/ghci/scripts/T10963.stderr
+++ b/testsuite/tests/ghci/scripts/T10963.stderr
@@ -3,11 +3,10 @@
• Ambiguous type variable ‘a0’ arising from a use of ‘foo’
prevents the constraint ‘(Num a0)’ from being solved.
Probable fix: use a type annotation to specify what ‘a0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance Num Integer -- Defined in ‘GHC.Num’
instance Num Double -- Defined in ‘GHC.Float’
- instance Num Float -- Defined in ‘GHC.Float’
- ...plus N others
- ...plus N instances involving out-of-scope types
+ ...plus three others
+ ...plus 8 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: foo
diff --git a/testsuite/tests/ghci/scripts/T15325.stderr b/testsuite/tests/ghci/scripts/T15325.stderr
index 99efb5585e..cd473af4dc 100644
--- a/testsuite/tests/ghci/scripts/T15325.stderr
+++ b/testsuite/tests/ghci/scripts/T15325.stderr
@@ -8,11 +8,10 @@ T15325.hs:11:9: warning: [-Wdeferred-type-errors (in -Wdefault)]
• Ambiguous type variable ‘e0’ arising from the literal ‘0’
prevents the constraint ‘(Num e0)’ from being solved.
Probable fix: use a type annotation to specify what ‘e0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance Num Integer -- Defined in ‘GHC.Num’
instance Num Double -- Defined in ‘GHC.Float’
- instance Num Float -- Defined in ‘GHC.Float’
- ...plus N others
+ ...plus three others
...plus one instance involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the first argument of ‘f’, namely ‘0’
diff --git a/testsuite/tests/indexed-types/should_fail/T12522a.stderr b/testsuite/tests/indexed-types/should_fail/T12522a.stderr
index 7fc4787a5c..cfde80b0b4 100644
--- a/testsuite/tests/indexed-types/should_fail/T12522a.stderr
+++ b/testsuite/tests/indexed-types/should_fail/T12522a.stderr
@@ -6,12 +6,11 @@ T12522a.hs:23:26: error:
n :: a0 (bound at T12522a.hs:23:15)
test :: Uncurried '[a0, [Char]] [Char] (bound at T12522a.hs:23:1)
Probable fix: use a type annotation to specify what ‘a0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
- instance Show Integer -- Defined in ‘GHC.Show’
- ...plus N others
- ...plus N instances involving out-of-scope types
+ ...plus 25 others
+ ...plus 12 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the first argument of ‘(++)’, namely ‘show n’
In the second argument of ‘($)’, namely ‘show n ++ s’
diff --git a/testsuite/tests/indexed-types/should_fail/T20466.stderr b/testsuite/tests/indexed-types/should_fail/T20466.stderr
index 90f09648f9..be526681ae 100644
--- a/testsuite/tests/indexed-types/should_fail/T20466.stderr
+++ b/testsuite/tests/indexed-types/should_fail/T20466.stderr
@@ -1,25 +1,27 @@
-T20466.hs:28:7:
- Overlapping instances for Cls (Either a (F (Either (G a) (G b))))
+T20466.hs:28:7: error:
+ • Overlapping instances for Cls (Either a (F (Either (G a) (G b))))
arising from a use of ‘foo’
- Matching instances:
+ Matching instance:
instance [overlappable] Cls a -- Defined at T20466.hs:20:31
+ Potentially matching instance:
instance Cls (Either Int Bool) -- Defined at T20466.hs:22:10
(The choice depends on the instantiation of ‘a, b’
and the result of evaluating ‘G, F’
To pick the first instance above, use IncoherentInstances
when compiling the other instance declarations)
- In the expression: foo
- In an equation for ‘bar’: bar = foo
+ • In the expression: foo
+ In an equation for ‘bar’: bar = foo
-T20466.hs:34:8:
- Overlapping instances for Cls (Either Int (F Bool))
+T20466.hs:34:8: error:
+ • Overlapping instances for Cls (Either Int (F Bool))
arising from a use of ‘foo'’
- Matching instances:
+ Matching instance:
instance [overlappable] Cls a -- Defined at T20466.hs:20:31
+ Potentially matching instance:
instance Cls (Either Int Bool) -- Defined at T20466.hs:22:10
(The choice depends on the result of evaluating ‘F’
To pick the first instance above, use IncoherentInstances
when compiling the other instance declarations)
- In the expression: foo'
+ • In the expression: foo'
In an equation for ‘bar'’: bar' = foo'
diff --git a/testsuite/tests/indexed-types/should_fail/T4485.stderr b/testsuite/tests/indexed-types/should_fail/T4485.stderr
index e6a3b888ac..71251b70f6 100644
--- a/testsuite/tests/indexed-types/should_fail/T4485.stderr
+++ b/testsuite/tests/indexed-types/should_fail/T4485.stderr
@@ -3,10 +3,11 @@ T4485.hs:51:15: error:
• Overlapping instances for EmbedAsChild
(IdentityT IO) (XMLGenT m0 (XML m0))
arising from a use of ‘asChild’
- Matching instances:
+ Matching instance:
instance [overlapping] (EmbedAsChild m c, m1 ~ m) =>
EmbedAsChild m (XMLGenT m1 c)
-- Defined at T4485.hs:29:30
+ Potentially matching instance:
instance [overlapping] EmbedAsChild
(IdentityT IO) (XMLGenT Identity ())
-- Defined at T4485.hs:46:30
@@ -23,7 +24,7 @@ T4485.hs:51:26: error:
• Ambiguous type variable ‘m0’ arising from a use of ‘genElement’
prevents the constraint ‘(XMLGen m0)’ from being solved.
Probable fix: use a type annotation to specify what ‘m0’ should be.
- This potential instance exists:
+ Potentially matching instance:
instance XMLGen (IdentityT m) -- Defined at T4485.hs:38: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 5d391c4d9e..e7daaeda0b 100644
--- a/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail01.stderr
+++ b/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail01.stderr
@@ -3,12 +3,11 @@ overloadedlistsfail01.hs:5:8: error:
• Ambiguous type variable ‘a0’ arising from a use of ‘print’
prevents the constraint ‘(Show a0)’ from being solved.
Probable fix: use a type annotation to specify what ‘a0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
- instance Show Integer -- Defined in ‘GHC.Show’
- ...plus N others
- ...plus N instances involving out-of-scope types
+ ...plus 25 others
+ ...plus 14 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: print [1]
In an equation for ‘main’: main = print [1]
@@ -17,9 +16,9 @@ overloadedlistsfail01.hs:5:14: error:
• Ambiguous type variable ‘a0’ arising from an overloaded list
prevents the constraint ‘(GHC.Exts.IsList a0)’ from being solved.
Probable fix: use a type annotation to specify what ‘a0’ should be.
- These potential instances exist:
+ Potentially matching instance:
instance GHC.Exts.IsList [a] -- Defined in ‘GHC.Exts’
- ...plus N instances involving out-of-scope types
+ ...plus four instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the first argument of ‘print’, namely ‘[1]’
In the expression: print [1]
@@ -30,11 +29,10 @@ overloadedlistsfail01.hs:5:15: error:
prevents the constraint ‘(Num
(GHC.Exts.Item a0))’ from being solved.
Probable fix: use a type annotation to specify what ‘a0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance Num Integer -- Defined in ‘GHC.Num’
instance Num Double -- Defined in ‘GHC.Float’
- instance Num Float -- Defined in ‘GHC.Float’
- ...plus N others
+ ...plus three others
...plus one instance involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: 1
diff --git a/testsuite/tests/parser/should_fail/RecordDotSyntaxFail11.stderr b/testsuite/tests/parser/should_fail/RecordDotSyntaxFail11.stderr
index 4c26d77b10..595f32c8b2 100644
--- a/testsuite/tests/parser/should_fail/RecordDotSyntaxFail11.stderr
+++ b/testsuite/tests/parser/should_fail/RecordDotSyntaxFail11.stderr
@@ -3,12 +3,11 @@ RecordDotSyntaxFail11.hs:8:3: error:
• Ambiguous type variable ‘a0’ arising from a use of ‘print’
prevents the constraint ‘(Show a0)’ from being solved.
Probable fix: use a type annotation to specify what ‘a0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
- instance Show Integer -- Defined in ‘GHC.Show’
- ...plus N others
- ...plus N instances involving out-of-scope types
+ ...plus 25 others
+ ...plus 12 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the first argument of ‘($)’, namely ‘print’
In a stmt of a 'do' block: print $ (.foo.bar.baz) a
diff --git a/testsuite/tests/parser/should_fail/RecordDotSyntaxFail8.stderr b/testsuite/tests/parser/should_fail/RecordDotSyntaxFail8.stderr
index e66a9dfb28..ee03f9e4a1 100644
--- a/testsuite/tests/parser/should_fail/RecordDotSyntaxFail8.stderr
+++ b/testsuite/tests/parser/should_fail/RecordDotSyntaxFail8.stderr
@@ -3,12 +3,11 @@ RecordDotSyntaxFail8.hs:37:3: error:
• Ambiguous type variable ‘a0’ arising from a use of ‘print’
prevents the constraint ‘(Show a0)’ from being solved.
Probable fix: use a type annotation to specify what ‘a0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show Bar -- Defined at RecordDotSyntaxFail8.hs:22:41
- instance Show Baz -- Defined at RecordDotSyntaxFail8.hs:27:42
- ...plus N others
- ...plus N instances involving out-of-scope types
+ ...plus 29 others
+ ...plus 12 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the first argument of ‘($)’, namely ‘print’
In a stmt of a 'do' block: print $ ....baz.quux
diff --git a/testsuite/tests/partial-sigs/should_fail/T10999.stderr b/testsuite/tests/partial-sigs/should_fail/T10999.stderr
index 22df588742..d6fe29c811 100644
--- a/testsuite/tests/partial-sigs/should_fail/T10999.stderr
+++ b/testsuite/tests/partial-sigs/should_fail/T10999.stderr
@@ -21,12 +21,11 @@ T10999.hs:8:28: error:
prevents the constraint ‘(Ord b0)’ from being solved.
Relevant bindings include g :: [b0] (bound at T10999.hs:8:1)
Probable fix: use a type annotation to specify what ‘b0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance Ord a => Ord (Set.Set a) -- Defined in ‘Data.Set.Internal’
instance Ord Ordering -- Defined in ‘GHC.Classes’
- instance Ord Integer -- Defined in ‘GHC.Num.Integer’
- ...plus N others
- ...plus N instances involving out-of-scope types
+ ...plus 24 others
+ ...plus two instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the second argument of ‘($)’, namely ‘f ()’
In the second argument of ‘($)’, namely ‘Set.toList $ f ()’
diff --git a/testsuite/tests/polykinds/T13393.stderr b/testsuite/tests/polykinds/T13393.stderr
index 759f3408b0..3836059249 100644
--- a/testsuite/tests/polykinds/T13393.stderr
+++ b/testsuite/tests/polykinds/T13393.stderr
@@ -3,12 +3,11 @@ T13393.hs:61:3: error:
• Ambiguous type variable ‘t0’ arising from a use of ‘mapM’
prevents the constraint ‘(Traversable t0)’ from being solved.
Probable fix: use a type annotation to specify what ‘t0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance Traversable (Either a) -- Defined in ‘Data.Traversable’
instance Traversable Identity -- Defined in ‘Data.Traversable’
- instance Traversable Maybe -- Defined in ‘Data.Traversable’
- ...plus N others
- ...plus N instances involving out-of-scope types
+ ...plus four others
+ ...plus 28 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In a stmt of a 'do' block:
mapM putBackLeftOverInputAndReturnOutput undefined
diff --git a/testsuite/tests/quotes/TH_localname.stderr b/testsuite/tests/quotes/TH_localname.stderr
index db549a63e2..246781a336 100644
--- a/testsuite/tests/quotes/TH_localname.stderr
+++ b/testsuite/tests/quotes/TH_localname.stderr
@@ -7,7 +7,7 @@ TH_localname.hs:3:11: error:
x :: t0 -> m0 Language.Haskell.TH.Syntax.Exp
(bound at TH_localname.hs:3:1)
Probable fix: use a type annotation to specify what ‘m0’ should be.
- These potential instances exist:
+ Potentially matching instance:
instance Language.Haskell.TH.Syntax.Quote IO
-- Defined in ‘Language.Haskell.TH.Syntax’
...plus one instance involving out-of-scope types
diff --git a/testsuite/tests/rebindable/rebindable6.stderr b/testsuite/tests/rebindable/rebindable6.stderr
index 0cee958265..1c9c3ee1e1 100644
--- a/testsuite/tests/rebindable/rebindable6.stderr
+++ b/testsuite/tests/rebindable/rebindable6.stderr
@@ -10,7 +10,7 @@ rebindable6.hs:110:17: error:
test_do :: IO a -> IO (Maybe b) -> IO b
(bound at rebindable6.hs:108:9)
Probable fix: use a type annotation to specify what ‘t0’ should be.
- This potential instance exists:
+ Potentially matching instance:
instance HasSeq (IO a -> IO b -> IO b)
-- Defined at rebindable6.hs:56:18
• In a stmt of a 'do' block: f
@@ -35,7 +35,7 @@ rebindable6.hs:111:17: error:
(bound at rebindable6.hs:108:9)
Probable fix: use a type annotation to specify what ‘p0’,
‘t0’ should be.
- This potential instance exists:
+ Potentially matching instance:
instance HasBind (IO a -> (a -> IO b) -> IO b)
-- Defined at rebindable6.hs:51:18
• In a stmt of a 'do' block: Just (b :: b) <- g
@@ -59,7 +59,7 @@ rebindable6.hs:112:17: error:
test_do :: IO a -> IO (Maybe b) -> IO b
(bound at rebindable6.hs:108:9)
Probable fix: use a type annotation to specify what ‘p0’ should be.
- This potential instance exists:
+ Potentially matching instance:
instance HasReturn (a -> IO a) -- Defined at rebindable6.hs:46:18
• In a stmt of a 'do' block: return b
In the expression:
diff --git a/testsuite/tests/typecheck/should_compile/T14273.stderr b/testsuite/tests/typecheck/should_compile/T14273.stderr
index 7aa78d56a9..acf1205cb7 100644
--- a/testsuite/tests/typecheck/should_compile/T14273.stderr
+++ b/testsuite/tests/typecheck/should_compile/T14273.stderr
@@ -6,13 +6,12 @@ T14273.hs:7:27: warning: [-Wdeferred-type-errors (in -Wdefault)]
pleaseShow :: forall a. Show a => Bool -> a -> Maybe String
at T14273.hs:5:1-49
The type variable ‘a1’ is ambiguous
- These potential instances exist:
+ Potentially matching instances:
instance (Show a, Show b) => Show (Either a b)
-- Defined in ‘Data.Either’
instance Show Ordering -- Defined in ‘GHC.Show’
- instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
- ...plus N others
- ...plus N instances involving out-of-scope types
+ ...plus 26 others
+ ...plus 71 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the first argument of ‘Just’, namely ‘(show _a)’
In the expression: Just (show _a)
@@ -60,13 +59,12 @@ T14273.hs:13:10: warning: [-Wdeferred-type-errors (in -Wdefault)]
• Ambiguous type variable ‘a0’ arising from a use of ‘show’
prevents the constraint ‘(Show a0)’ from being solved.
Probable fix: use a type annotation to specify what ‘a0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance (Show a, Show b) => Show (Either a b)
-- Defined in ‘Data.Either’
instance Show Ordering -- Defined in ‘GHC.Show’
- instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
- ...plus N others
- ...plus N instances involving out-of-scope types
+ ...plus 26 others
+ ...plus 28 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: show (_h ++ [])
In an equation for ‘foo’: foo xs = show (_h ++ [])
diff --git a/testsuite/tests/typecheck/should_compile/holes2.stderr b/testsuite/tests/typecheck/should_compile/holes2.stderr
index a88ea524e0..47de4c617a 100644
--- a/testsuite/tests/typecheck/should_compile/holes2.stderr
+++ b/testsuite/tests/typecheck/should_compile/holes2.stderr
@@ -3,13 +3,12 @@ holes2.hs:3:5: warning: [-Wdeferred-type-errors (in -Wdefault)]
• Ambiguous type variable ‘a0’ arising from a use of ‘show’
prevents the constraint ‘(Show a0)’ from being solved.
Probable fix: use a type annotation to specify what ‘a0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance (Show a, Show b) => Show (Either a b)
-- Defined in ‘Data.Either’
instance Show Ordering -- Defined in ‘GHC.Show’
- instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
- ...plus N others
- ...plus N instances involving out-of-scope types
+ ...plus 26 others
+ ...plus 71 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: show _
In an equation for ‘f’: f = show _
diff --git a/testsuite/tests/typecheck/should_fail/FailDueToGivenOverlapping.stderr b/testsuite/tests/typecheck/should_fail/FailDueToGivenOverlapping.stderr
index 651aad6c57..57d5ceb9e8 100644
--- a/testsuite/tests/typecheck/should_fail/FailDueToGivenOverlapping.stderr
+++ b/testsuite/tests/typecheck/should_fail/FailDueToGivenOverlapping.stderr
@@ -6,7 +6,7 @@ FailDueToGivenOverlapping.hs:27:9: error:
bound by the type signature for:
bar :: E [Int] => () -> ()
at FailDueToGivenOverlapping.hs:26:1-26
- Matching instances:
+ Matching instance:
instance E [a] -- Defined at FailDueToGivenOverlapping.hs:21:10
(The choice depends on the instantiation of ‘a0’)
• In the expression: eop [undefined]
diff --git a/testsuite/tests/typecheck/should_fail/T10971b.stderr b/testsuite/tests/typecheck/should_fail/T10971b.stderr
index 1a6104d501..b527f8d07c 100644
--- a/testsuite/tests/typecheck/should_fail/T10971b.stderr
+++ b/testsuite/tests/typecheck/should_fail/T10971b.stderr
@@ -6,12 +6,11 @@ T10971b.hs:4:11: error:
x :: t2 a (bound at T10971b.hs:4:6)
f :: t2 a -> Int (bound at T10971b.hs:4:1)
Probable fix: use a type annotation to specify what ‘t2’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance Foldable (Either a) -- Defined in ‘Data.Foldable’
instance Foldable Maybe -- Defined in ‘Data.Foldable’
- instance Foldable ((,) a) -- Defined in ‘Data.Foldable’
- ...plus N others
- ...plus N instances involving out-of-scope types
+ ...plus three others
+ ...plus 29 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: length x
In the expression: \ x -> length x
@@ -24,12 +23,11 @@ T10971b.hs:5:13: error:
x :: t1 a (bound at T10971b.hs:5:8)
g :: (a -> b) -> t1 a -> t1 b (bound at T10971b.hs:5:1)
Probable fix: use a type annotation to specify what ‘t1’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance Traversable (Either a) -- Defined in ‘Data.Traversable’
instance Traversable Maybe -- Defined in ‘Data.Traversable’
- instance Traversable ((,) a) -- Defined in ‘Data.Traversable’
- ...plus N others
- ...plus N instances involving out-of-scope types
+ ...plus three others
+ ...plus 29 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: fmapDefault f x
In the expression: \ f x -> fmapDefault f x
@@ -42,12 +40,11 @@ T10971b.hs:6:14: error:
x :: t0 a (bound at T10971b.hs:6:8)
h :: (a -> b) -> t0 a -> (t0 b, Int) (bound at T10971b.hs:6:1)
Probable fix: use a type annotation to specify what ‘t0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance Traversable (Either a) -- Defined in ‘Data.Traversable’
instance Traversable Maybe -- Defined in ‘Data.Traversable’
- instance Traversable ((,) a) -- Defined in ‘Data.Traversable’
- ...plus N others
- ...plus N instances involving out-of-scope types
+ ...plus three others
+ ...plus 29 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: fmapDefault f x
In the expression: (fmapDefault f x, length x)
@@ -60,12 +57,11 @@ T10971b.hs:6:31: error:
x :: t0 a (bound at T10971b.hs:6:8)
h :: (a -> b) -> t0 a -> (t0 b, Int) (bound at T10971b.hs:6:1)
Probable fix: use a type annotation to specify what ‘t0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance Foldable (Either a) -- Defined in ‘Data.Foldable’
instance Foldable Maybe -- Defined in ‘Data.Foldable’
- instance Foldable ((,) a) -- Defined in ‘Data.Foldable’
- ...plus N others
- ...plus N instances involving out-of-scope types
+ ...plus three others
+ ...plus 29 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: length x
In the expression: (fmapDefault f x, length x)
diff --git a/testsuite/tests/typecheck/should_fail/T12921.stderr b/testsuite/tests/typecheck/should_fail/T12921.stderr
index b3de93e2f4..8b1e638d27 100644
--- a/testsuite/tests/typecheck/should_fail/T12921.stderr
+++ b/testsuite/tests/typecheck/should_fail/T12921.stderr
@@ -3,15 +3,13 @@ T12921.hs:4:1: error:
• Ambiguous type variable ‘a0’ arising from an annotation
prevents the constraint ‘(Data.Data.Data a0)’ from being solved.
Probable fix: use a type annotation to specify what ‘a0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance (Data.Data.Data a, Data.Data.Data b) =>
Data.Data.Data (Either a b)
-- Defined in ‘Data.Data’
instance Data.Data.Data Ordering -- Defined in ‘Data.Data’
- instance Data.Data.Data a => Data.Data.Data (Maybe a)
- -- Defined in ‘Data.Data’
- ...plus N others
- ...plus N instances involving out-of-scope types
+ ...plus 17 others
+ ...plus 50 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the annotation:
{-# ANN module "HLint: ignore Reduce duplication" #-}
@@ -21,10 +19,10 @@ T12921.hs:4:16: error:
prevents the constraint ‘(Data.String.IsString
a0)’ from being solved.
Probable fix: use a type annotation to specify what ‘a0’ should be.
- These potential instances exist:
+ Potentially matching instance:
instance (a ~ Char) => Data.String.IsString [a]
-- Defined in ‘Data.String’
- ...plus N instances involving out-of-scope types
+ ...plus two instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the annotation:
{-# ANN module "HLint: ignore Reduce duplication" #-}
diff --git a/testsuite/tests/typecheck/should_fail/T13292.stderr b/testsuite/tests/typecheck/should_fail/T13292.stderr
index 2cc7bb41c3..9d0d3fe7ee 100644
--- a/testsuite/tests/typecheck/should_fail/T13292.stderr
+++ b/testsuite/tests/typecheck/should_fail/T13292.stderr
@@ -5,11 +5,10 @@ T13292a.hs:4:12: warning: [-Wdeferred-type-errors (in -Wdefault)]
Relevant bindings include
someFunc :: m0 () (bound at T13292a.hs:4:1)
Probable fix: use a type annotation to specify what ‘m0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance Monad IO -- Defined in ‘GHC.Base’
instance Monad Maybe -- Defined in ‘GHC.Base’
- instance Monad ((->) r) -- Defined in ‘GHC.Base’
- ...plus N others
+ ...plus six others
...plus one instance involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: return ()
diff --git a/testsuite/tests/typecheck/should_fail/T14884.stderr b/testsuite/tests/typecheck/should_fail/T14884.stderr
index e28ad780bf..d949df2ec6 100644
--- a/testsuite/tests/typecheck/should_fail/T14884.stderr
+++ b/testsuite/tests/typecheck/should_fail/T14884.stderr
@@ -35,13 +35,12 @@ T14884.hs:4:7: error:
• Ambiguous type variable ‘a0’ arising from a use of ‘print’
prevents the constraint ‘(Show a0)’ from being solved.
Probable fix: use a type annotation to specify what ‘a0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance (Show a, Show b) => Show (Either a b)
-- Defined in ‘Data.Either’
instance Show Ordering -- Defined in ‘GHC.Show’
- instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
- ...plus N others
- ...plus N instances involving out-of-scope types
+ ...plus 26 others
+ ...plus 28 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the first argument of ‘_’, namely ‘print’
In the expression: _ print "abc"
diff --git a/testsuite/tests/typecheck/should_fail/T15883b.stderr b/testsuite/tests/typecheck/should_fail/T15883b.stderr
index 4da31915ac..0e03d99a37 100644
--- a/testsuite/tests/typecheck/should_fail/T15883b.stderr
+++ b/testsuite/tests/typecheck/should_fail/T15883b.stderr
@@ -3,11 +3,10 @@ T15883b.hs:14:1: error:
• Ambiguous type variable ‘a0’ arising from a use of ‘==’
prevents the constraint ‘(Eq a0)’ from being solved.
Probable fix: use a type annotation to specify what ‘a0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance Eq SpecConstrAnnotation -- Defined in ‘GHC.Exts’
instance Eq Ordering -- Defined in ‘GHC.Classes’
- instance Eq (Foo LiftedRep) -- Defined at T15883b.hs:14:1
- ...plus 24 others
+ ...plus 25 others
...plus four instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: a1 == b1
diff --git a/testsuite/tests/typecheck/should_fail/T15883c.stderr b/testsuite/tests/typecheck/should_fail/T15883c.stderr
index 07451af880..c55a688ed9 100644
--- a/testsuite/tests/typecheck/should_fail/T15883c.stderr
+++ b/testsuite/tests/typecheck/should_fail/T15883c.stderr
@@ -8,11 +8,10 @@ T15883c.hs:14:1: error:
• Ambiguous type variable ‘a0’ arising from a use of ‘compare’
prevents the constraint ‘(Ord a0)’ from being solved.
Probable fix: use a type annotation to specify what ‘a0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance Ord Ordering -- Defined in ‘GHC.Classes’
instance Ord (Foo LiftedRep) -- Defined at T15883c.hs:14:1
- instance Ord Integer -- Defined in ‘GHC.Num.Integer’
- ...plus 23 others
+ ...plus 24 others
...plus two instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: a1 `compare` b1
@@ -26,11 +25,10 @@ T15883c.hs:14:1: error:
• Ambiguous type variable ‘a1’ arising from a use of ‘<’
prevents the constraint ‘(Ord a1)’ from being solved.
Probable fix: use a type annotation to specify what ‘a1’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance Ord Ordering -- Defined in ‘GHC.Classes’
instance Ord (Foo LiftedRep) -- Defined at T15883c.hs:14:1
- instance Ord Integer -- Defined in ‘GHC.Num.Integer’
- ...plus 23 others
+ ...plus 24 others
...plus two instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: a1 < b1
diff --git a/testsuite/tests/typecheck/should_fail/T15883d.stderr b/testsuite/tests/typecheck/should_fail/T15883d.stderr
index ba5618628d..eea1ccac2d 100644
--- a/testsuite/tests/typecheck/should_fail/T15883d.stderr
+++ b/testsuite/tests/typecheck/should_fail/T15883d.stderr
@@ -3,11 +3,10 @@ T15883d.hs:14:1: error:
• Ambiguous type variable ‘a0’ arising from a use of ‘showsPrec’
prevents the constraint ‘(Show a0)’ from being solved.
Probable fix: use a type annotation to specify what ‘a0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show (Foo LiftedRep) -- Defined at T15883d.hs:14:1
- instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
- ...plus 28 others
+ ...plus 29 others
...plus 9 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the second argument of ‘(.)’, namely ‘(showsPrec 11 b1)’
diff --git a/testsuite/tests/typecheck/should_fail/T15883e.stderr b/testsuite/tests/typecheck/should_fail/T15883e.stderr
index 81b6d8172a..947e45270f 100644
--- a/testsuite/tests/typecheck/should_fail/T15883e.stderr
+++ b/testsuite/tests/typecheck/should_fail/T15883e.stderr
@@ -3,12 +3,11 @@ T15883e.hs:16:1: error:
• Ambiguous type variable ‘d0’ arising from a use of ‘k’
prevents the constraint ‘(Data d0)’ from being solved.
Probable fix: use a type annotation to specify what ‘d0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance (Data a, Data b) => Data (Either a b)
-- Defined in ‘Data.Data’
instance Data a => Data (Down a) -- Defined in ‘Data.Data’
- instance Data SpecConstrAnnotation -- Defined in ‘GHC.Exts’
- ...plus 20 others
+ ...plus 21 others
...plus 48 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: z (\ a1 -> MkFoo a1) `k` a1
@@ -38,12 +37,11 @@ T15883e.hs:16:1: error:
• Ambiguous type variable ‘b0’ arising from a use of ‘k’
prevents the constraint ‘(Data b0)’ from being solved.
Probable fix: use a type annotation to specify what ‘b0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance (Data a, Data b) => Data (Either a b)
-- Defined in ‘Data.Data’
instance Data a => Data (Down a) -- Defined in ‘Data.Data’
- instance Data SpecConstrAnnotation -- Defined in ‘GHC.Exts’
- ...plus 20 others
+ ...plus 21 others
...plus 48 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: k (z (\ a1 -> MkFoo a1))
diff --git a/testsuite/tests/typecheck/should_fail/T16414.stderr b/testsuite/tests/typecheck/should_fail/T16414.stderr
index 601f4097db..57a31ffd4b 100644
--- a/testsuite/tests/typecheck/should_fail/T16414.stderr
+++ b/testsuite/tests/typecheck/should_fail/T16414.stderr
@@ -6,7 +6,7 @@ T16414.hs:15:6: error:
bound by the type signature for:
f1 :: forall x. (All x, AllZip2 I) => x -> ()
at T16414.hs:14:1-35
- Matching instances:
+ Matching instance:
instance AllZip2 f -- Defined at T16414.hs:12:10
(The choice depends on the instantiation of ‘f0’)
• In the expression: f2
diff --git a/testsuite/tests/typecheck/should_fail/T20122.stderr b/testsuite/tests/typecheck/should_fail/T20122.stderr
index f3e987ee23..d810d1433f 100644
--- a/testsuite/tests/typecheck/should_fail/T20122.stderr
+++ b/testsuite/tests/typecheck/should_fail/T20122.stderr
@@ -5,8 +5,7 @@ T20122.hs:11:7: error:
Relevant bindings include
foo :: a0 -> Bool (bound at T20122.hs:11:1)
Probable fix: use a type annotation to specify what ‘a0’ should be.
- This potential instance exists:
- instance Testable A
- -- Defined at T20122.hs:8:10
+ Potentially matching instance:
+ instance Testable A -- Defined at T20122.hs:8:10
• In the expression: test
In an equation for ‘foo’: foo = test
diff --git a/testsuite/tests/typecheck/should_fail/T20542.hs b/testsuite/tests/typecheck/should_fail/T20542.hs
new file mode 100644
index 0000000000..20c068dd59
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T20542.hs
@@ -0,0 +1,17 @@
+{-# LANGUAGE TypeSynonymInstances #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+
+module T20542 where
+
+class Foo a b where
+ foo :: a -> b
+
+instance {-# OVERLAPPABLE #-} Show a => Foo a String where
+ foo = show
+
+instance {-# OVERLAPPING #-} Read b => Foo String b where
+ foo = read
+
+bar :: String -> String
+bar = foo
diff --git a/testsuite/tests/typecheck/should_fail/T20542.stderr b/testsuite/tests/typecheck/should_fail/T20542.stderr
new file mode 100644
index 0000000000..14fb60848c
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T20542.stderr
@@ -0,0 +1,15 @@
+
+T20542.hs:17:7: error:
+ • Overlapping instances for Foo String String
+ arising from a use of ‘foo’
+ Matching instances:
+ instance [overlappable] Show a => Foo a String
+ -- Defined at T20542.hs:10:31
+ instance [overlapping] Read b => Foo String b
+ -- Defined at T20542.hs:13:30
+ An overlapping instance can only be chosen when it is strictly more specific.
+ The first instance that follows overlaps the second, but is not more specific than it:
+ instance [overlapping] Read b => Foo String b
+ instance [overlappable] Show a => Foo a String
+ • In the expression: foo
+ In an equation for ‘bar’: bar = foo
diff --git a/testsuite/tests/typecheck/should_fail/T4921.stderr b/testsuite/tests/typecheck/should_fail/T4921.stderr
index c4510cbb08..392928b7eb 100644
--- a/testsuite/tests/typecheck/should_fail/T4921.stderr
+++ b/testsuite/tests/typecheck/should_fail/T4921.stderr
@@ -5,7 +5,7 @@ T4921.hs:10:9: error:
Relevant bindings include x :: a0 (bound at T4921.hs:10:1)
Probable fix: use a type annotation to specify what ‘a0’,
‘b1’ should be.
- This potential instance exists:
+ Potentially matching instance:
instance C Int Char -- Defined at T4921.hs:7:10
• In the first argument of ‘fst’, namely ‘f’
In the expression: fst f
@@ -15,7 +15,7 @@ T4921.hs:12:9: error:
• Ambiguous type variable ‘b0’ arising from a use of ‘f’
prevents the constraint ‘(C Int b0)’ from being solved.
Probable fix: use a type annotation to specify what ‘b0’ should be.
- This potential instance exists:
+ Potentially matching instance:
instance C Int Char -- Defined at T4921.hs:7:10
• In the first argument of ‘fst’, namely ‘f’
In the expression: fst f :: Int
diff --git a/testsuite/tests/typecheck/should_fail/T5095.stderr b/testsuite/tests/typecheck/should_fail/T5095.stderr
index 3641d18f34..27784f8250 100644
--- a/testsuite/tests/typecheck/should_fail/T5095.stderr
+++ b/testsuite/tests/typecheck/should_fail/T5095.stderr
@@ -1,12 +1,13 @@
T5095.hs:9:11: error:
• Overlapping instances for Eq a arising from a use of ‘==’
- Matching instances:
+ Matching instance:
instance [overlappable] Show a => Eq a -- Defined at T5095.hs:5:31
+ Potentially matching instances:
instance Eq Ordering -- Defined in ‘GHC.Classes’
instance Eq a => Eq (Maybe a) -- Defined in ‘GHC.Maybe’
- ...plus N others
- ...plus N instances involving out-of-scope types
+ ...plus 24 others
+ ...plus six instances 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
diff --git a/testsuite/tests/typecheck/should_fail/T5858.stderr b/testsuite/tests/typecheck/should_fail/T5858.stderr
index d5474da8a4..5679c6a995 100644
--- a/testsuite/tests/typecheck/should_fail/T5858.stderr
+++ b/testsuite/tests/typecheck/should_fail/T5858.stderr
@@ -5,7 +5,7 @@ T5858.hs:11:7: error:
([a0], [a1]))’ from being solved.
Probable fix: use a type annotation to specify what ‘a0’,
‘a1’ should be.
- This potential instance exists:
+ Potentially matching instance:
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 2596efb51f..44bdc1a7da 100644
--- a/testsuite/tests/typecheck/should_fail/T7857.stderr
+++ b/testsuite/tests/typecheck/should_fail/T7857.stderr
@@ -5,13 +5,13 @@ T7857.hs:8:11: error:
bound by the inferred type of g :: PrintfArg t => t -> b
at T7857.hs:8:1-21
The type variable ‘a0’ is ambiguous
- These potential instances exist:
+ Potentially matching instances:
instance [safe] (a ~ ()) => PrintfType (IO a)
-- Defined in ‘Text.Printf’
instance [safe] (PrintfArg a, PrintfType r) => PrintfType (a -> r)
-- Defined in ‘Text.Printf’
- instance [safe] IsChar c => PrintfType [c]
- -- Defined in ‘Text.Printf’
+ ...plus one other
+ (use -fprint-potential-instances to see them all)
• In the second argument of ‘($)’, namely ‘printf "" i’
In the expression: f $ printf "" i
In an equation for ‘g’: g i = f $ printf "" i
diff --git a/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBindingExistential.stderr b/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBindingExistential.stderr
index e316f78fc6..f400dd63ae 100644
--- a/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBindingExistential.stderr
+++ b/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBindingExistential.stderr
@@ -20,12 +20,11 @@ TyAppPat_PatternBindingExistential.hs:13:3: error:
• Ambiguous type variable ‘a0’ arising from a use of ‘print’
prevents the constraint ‘(Show a0)’ from being solved.
Probable fix: use a type annotation to specify what ‘a0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
- instance Show Integer -- Defined in ‘GHC.Show’
- ...plus N others
- ...plus N instances involving out-of-scope types
+ ...plus 25 others
+ ...plus 12 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In a stmt of a 'do' block: print (x :: a)
In the expression: do print (x :: a)
diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T
index 4dba37c780..bba77ee675 100644
--- a/testsuite/tests/typecheck/should_fail/all.T
+++ b/testsuite/tests/typecheck/should_fail/all.T
@@ -624,4 +624,5 @@ test('T20122', normal, compile_fail, [''])
test('T20241b', normal, compile_fail, [''])
test('T20260', normal, compile_fail, [''])
test('OrdErr', normal, compile_fail, [''])
+test('T20542', normal, compile_fail, [''])
test('T20588', [extra_files(['T20588.hs', 'T20588.hs-boot', 'T20588_aux.hs'])], multimod_compile_fail, ['T20588_aux.hs', '-v0'])
diff --git a/testsuite/tests/typecheck/should_fail/tcfail008.stderr b/testsuite/tests/typecheck/should_fail/tcfail008.stderr
index 974eccb485..ba3afc1b67 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail008.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail008.stderr
@@ -4,11 +4,10 @@ tcfail008.hs:3:5: error:
prevents the constraint ‘(Num a0)’ from being solved.
Relevant bindings include o :: [a0] (bound at tcfail008.hs:3:1)
Probable fix: use a type annotation to specify what ‘a0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance Num Integer -- Defined in ‘GHC.Num’
instance Num Double -- Defined in ‘GHC.Float’
- instance Num Float -- Defined in ‘GHC.Float’
- ...plus N others
+ ...plus three others
...plus one instance involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the first argument of ‘(:)’, namely ‘1’
diff --git a/testsuite/tests/typecheck/should_fail/tcfail040.stderr b/testsuite/tests/typecheck/should_fail/tcfail040.stderr
index 46e0b86577..b920c9dc96 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail040.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail040.stderr
@@ -3,7 +3,7 @@ tcfail040.hs:19:5: error:
• Ambiguous type variable ‘a0’ arising from a use of ‘<<’
prevents the constraint ‘(ORD a0)’ from being solved.
Probable fix: use a type annotation to specify what ‘a0’ should be.
- This potential instance exists:
+ Potentially matching instance:
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 03aef3db67..e30b7c6aaa 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail043.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail043.stderr
@@ -7,7 +7,7 @@ tcfail043.hs:38:17: error:
a :: a0 (bound at tcfail043.hs:38:6)
search :: a0 -> [a0] -> Bool (bound at tcfail043.hs:37:1)
Probable fix: use a type annotation to specify what ‘a0’ should be.
- This potential instance exists:
+ Potentially matching instance:
instance Ord_ Int -- Defined at tcfail043.hs:34:10
• In the expression: gt (hd bs) a
In the expression:
@@ -30,7 +30,7 @@ tcfail043.hs:40:25: error:
a :: a0 (bound at tcfail043.hs:38:6)
search :: a0 -> [a0] -> Bool (bound at tcfail043.hs:37:1)
Probable fix: use a type annotation to specify what ‘a0’ should be.
- These potential instances exist:
+ Potentially matching 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 c916c92df1..3c544083e8 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail072.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail072.stderr
@@ -6,12 +6,11 @@ tcfail072.hs:23:13: error:
g :: forall p q. (Ord p, Ord q) => AB p q -> Bool
at tcfail072.hs:22:1-38
The type variable ‘p0’ is ambiguous
- These potential instances exist:
+ Potentially matching instances:
instance Ord Ordering -- Defined in ‘GHC.Classes’
instance Ord Integer -- Defined in ‘GHC.Num.Integer’
- instance Ord () -- Defined in ‘GHC.Classes’
- ...plus N others
- ...plus N instances involving out-of-scope types
+ ...plus 23 others
+ ...plus two instances 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/tcfail121.stderr b/testsuite/tests/typecheck/should_fail/tcfail121.stderr
index dc0679edca..179729586f 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail121.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail121.stderr
@@ -1,12 +1,13 @@
-tcfail121.hs:13:9:
- Overlapping instances for Foo [a] arising from a use of ‘op’
- Matching instances:
- instance [overlappable] Foo a => Foo [a]
- -- Defined at tcfail121.hs:9:31
- instance [overlapping] Foo [Int] -- Defined at tcfail121.hs:10:30
- (The choice depends on the instantiation of ‘a’
- To pick the first instance above, use IncoherentInstances
- when compiling the other instance declarations)
- In the expression: op x
- In an equation for ‘foo’: foo x = op x
+tcfail121.hs:13:9: error:
+ • Overlapping instances for Foo [a] arising from a use of ‘op’
+ Matching instance:
+ instance [overlappable] Foo a => Foo [a]
+ -- Defined at tcfail121.hs:9:31
+ Potentially matching instance:
+ instance [overlapping] Foo [Int] -- Defined at tcfail121.hs:10:30
+ (The choice depends on the instantiation of ‘a’
+ To pick the first instance above, use IncoherentInstances
+ when compiling the other instance declarations)
+ • In the expression: op x
+ In an equation for ‘foo’: foo x = op x
diff --git a/testsuite/tests/typecheck/should_fail/tcfail128.stderr b/testsuite/tests/typecheck/should_fail/tcfail128.stderr
index a63f290418..42bd22b6c9 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail128.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail128.stderr
@@ -4,9 +4,8 @@ tcfail128.hs:18:16: error:
prevents the constraint ‘(Data.Array.Base.MArray
b0 FlatVector IO)’ from being solved.
Probable fix: use a type annotation to specify what ‘b0’ should be.
- This potential instance exists:
- one instance involving out-of-scope types
- (use -fprint-potential-instances to see them all)
+ one instance involving out-of-scope types
+ (use -fprint-potential-instances to see them all)
• In a stmt of a 'do' block: v <- thaw tmp
In the expression:
do let sL = ...
diff --git a/testsuite/tests/typecheck/should_fail/tcfail133.stderr b/testsuite/tests/typecheck/should_fail/tcfail133.stderr
index 004c06a288..d88b8db0ec 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail133.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail133.stderr
@@ -6,13 +6,12 @@ tcfail133.hs:68:7: error:
• Ambiguous type variable ‘a0’ arising from a use of ‘show’
prevents the constraint ‘(Show a0)’ from being solved.
Probable fix: use a type annotation to specify what ‘a0’ should be.
- These potential instances exist:
+ Potentially matching instances:
instance Show Ordering -- Defined in ‘GHC.Show’
instance (Number a, Digit b, Show a, Show b) => Show (a :@ b)
-- Defined at tcfail133.hs:11:54
- instance Show One -- Defined at tcfail133.hs:9:28
- ...plus N others
- ...plus N instances involving out-of-scope types
+ ...plus 28 others
+ ...plus 12 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the first argument of ‘($)’, namely ‘show’
In the expression: show $ add (One :@ Zero) (One :@ One)
diff --git a/testsuite/tests/typecheck/should_fail/tcfail181.stderr b/testsuite/tests/typecheck/should_fail/tcfail181.stderr
index f878123949..887c65f574 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail181.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail181.stderr
@@ -6,11 +6,10 @@ tcfail181.hs:17:9: error:
wog :: Monad m => p -> Something (m Bool) e
at tcfail181.hs:17:1-30
The type variable ‘m0’ is ambiguous
- These potential instances exist:
+ Potentially matching instances:
instance Monad IO -- Defined in ‘GHC.Base’
instance Monad Maybe -- Defined in ‘GHC.Base’
- instance Monad ((->) r) -- Defined in ‘GHC.Base’
- ...plus N others
+ ...plus six others
...plus one instance involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: foo
diff --git a/testsuite/tests/typecheck/should_fail/tcfail218.stderr b/testsuite/tests/typecheck/should_fail/tcfail218.stderr
index f591b09b2a..2435fe3070 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail218.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail218.stderr
@@ -1,8 +1,9 @@
tcfail218.hs:16:5: error:
• Overlapping instances for C [a] Bool arising from a use of ‘foo’
- Matching instances:
+ Matching instance:
instance C [a] b -- Defined at tcfail218.hs:8:29
+ Potentially matching instance:
instance C [Int] Bool -- Defined at tcfail218.hs:7:29
(The choice depends on the instantiation of ‘a’
To pick the first instance above, use IncoherentInstances