summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthías Páll Gissurarson <mpg@mpg.is>2018-01-18 00:49:38 -0500
committerBen Gamari <ben@smart-cactus.org>2018-01-18 00:49:40 -0500
commit1e14fd3ecfd468c3beddb2e5f992c358e1a798de (patch)
tree080300ea965349584307202930ef7d1cbd8e5c1f
parent6b1ff0098e7595d5f3b8e6ad7c5d8e4104b02445 (diff)
downloadhaskell-1e14fd3ecfd468c3beddb2e5f992c358e1a798de.tar.gz
Inform hole substitutions of typeclass constraints (fixes #14273).
This implements SPJ's suggestion on the ticket (#14273). We find the relevant constraints (ones that whose free unification variables are all mentioned in the type of the hole), and then clone the free unification variables of the hole and the relevant constraints. We then add a subsumption constraints and run the simplifier, and then check whether all the constraints were solved. Reviewers: bgamari Reviewed By: bgamari Subscribers: RyanGlScott, rwbarton, thomie, carter GHC Trac Issues: #14273 Differential Revision: https://phabricator.haskell.org/D4315
-rw-r--r--compiler/typecheck/TcErrors.hs271
-rw-r--r--compiler/typecheck/TcRnTypes.hs13
-rw-r--r--compiler/typecheck/TcSimplify.hs16
-rw-r--r--compiler/typecheck/TcSimplify.hs-boot6
-rw-r--r--testsuite/tests/ghci/scripts/T8353.stderr5
-rw-r--r--testsuite/tests/th/T10267.stderr5
-rw-r--r--testsuite/tests/th/all.T2
-rw-r--r--testsuite/tests/typecheck/should_compile/T13050.stderr6
-rw-r--r--testsuite/tests/typecheck/should_compile/T14273.hs13
-rw-r--r--testsuite/tests/typecheck/should_compile/T14273.stderr80
-rw-r--r--testsuite/tests/typecheck/should_compile/T14590.stderr10
-rw-r--r--testsuite/tests/typecheck/should_compile/T9497a.stderr1
-rw-r--r--testsuite/tests/typecheck/should_compile/all.T2
-rw-r--r--testsuite/tests/typecheck/should_compile/hole_constraints.stderr8
-rw-r--r--testsuite/tests/typecheck/should_compile/holes.stderr448
-rw-r--r--testsuite/tests/typecheck/should_compile/holes2.stderr24
-rw-r--r--testsuite/tests/typecheck/should_compile/holes3.stderr448
-rw-r--r--testsuite/tests/typecheck/should_compile/valid_substitutions.hs22
-rw-r--r--testsuite/tests/typecheck/should_compile/valid_substitutions.stderr237
-rw-r--r--testsuite/tests/typecheck/should_compile/valid_substitutions_interactions.hs15
-rw-r--r--testsuite/tests/typecheck/should_compile/valid_substitutions_interactions.stderr18
-rw-r--r--testsuite/tests/typecheck/should_fail/T9497d.stderr1
-rw-r--r--testsuite/tests/typecheck/should_run/T9497a-run.stderr1
-rw-r--r--testsuite/tests/typecheck/should_run/T9497b-run.stderr1
-rw-r--r--testsuite/tests/typecheck/should_run/T9497c-run.stderr1
25 files changed, 1499 insertions, 155 deletions
diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs
index e372c30971..1c7d643bc1 100644
--- a/compiler/typecheck/TcErrors.hs
+++ b/compiler/typecheck/TcErrors.hs
@@ -48,8 +48,8 @@ import ErrUtils ( ErrMsg, errDoc, pprLocErrMsg )
import BasicTypes
import ConLike ( ConLike(..))
import Util
-import TcEnv (tcLookupIdMaybe)
-import {-# SOURCE #-} TcSimplify ( tcSubsumes )
+import TcEnv (tcLookup)
+import {-# SOURCE #-} TcSimplify ( tcCheckHoleFit )
import FastString
import Outputable
import SrcLoc
@@ -58,7 +58,7 @@ import ListSetOps ( equivClasses )
import Maybes
import Pair
import qualified GHC.LanguageExtensions as LangExt
-import FV ( fvVarList, unionFV )
+import FV ( fvVarList, fvVarSet, unionFV )
import Control.Monad ( when )
import Data.Foldable ( toList )
@@ -453,7 +453,6 @@ reportWanteds :: ReportErrCtxt -> TcLevel -> WantedConstraints -> TcM ()
reportWanteds ctxt tc_lvl (WC { wc_simple = simples, wc_impl = implics })
= do { traceTc "reportWanteds" (vcat [ text "Simples =" <+> ppr simples
, text "Suppress =" <+> ppr (cec_suppress ctxt)])
- ; let tidy_cts = bagToList (mapBag (tidyCt env) simples)
; traceTc "rw2" (ppr tidy_cts)
-- First deal with things that are utterly wrong
@@ -481,6 +480,7 @@ reportWanteds ctxt tc_lvl (WC { wc_simple = simples, wc_impl = implics })
-- if there's a *given* insoluble here (= inaccessible code)
where
env = cec_tidy ctxt
+ tidy_cts = bagToList (mapBag (tidyCt env) simples)
-- report1: ones that should *not* be suppresed by
-- an insoluble somewhere else in the tree
@@ -490,12 +490,12 @@ reportWanteds ctxt tc_lvl (WC { wc_simple = simples, wc_impl = implics })
-- type checking to get a Lint error later
report1 = [ ("custom_error", is_user_type_error,True, mkUserTypeErrorReporter)
, given_eq_spec
- , ("insoluble2", utterly_wrong, True, mkGroupReporter mkEqErr)
- , ("skolem eq1", very_wrong, True, mkSkolReporter)
- , ("skolem eq2", skolem_eq, True, mkSkolReporter)
- , ("non-tv eq", non_tv_eq, True, mkSkolReporter)
- , ("Out of scope", is_out_of_scope, True, mkHoleReporter)
- , ("Holes", is_hole, False, mkHoleReporter)
+ , ("insoluble2", utterly_wrong, True, mkGroupReporter mkEqErr)
+ , ("skolem eq1", very_wrong, True, mkSkolReporter)
+ , ("skolem eq2", skolem_eq, True, mkSkolReporter)
+ , ("non-tv eq", non_tv_eq, True, mkSkolReporter)
+ , ("Out of scope", is_out_of_scope,True, mkHoleReporter tidy_cts)
+ , ("Holes", is_hole, False, mkHoleReporter tidy_cts)
-- The only remaining equalities are alpha ~ ty,
-- where alpha is untouchable; and representational equalities
@@ -617,10 +617,10 @@ mkSkolReporter ctxt cts
| eq_lhs_type ct1 ct2 = True
| otherwise = False
-mkHoleReporter :: Reporter
+mkHoleReporter :: [Ct] -> Reporter
-- Reports errors one at a time
-mkHoleReporter ctxt
- = mapM_ $ \ct -> do { err <- mkHoleError ctxt ct
+mkHoleReporter tidy_simples ctxt
+ = mapM_ $ \ct -> do { err <- mkHoleError tidy_simples ctxt ct
; maybeReportHoleError ctxt ct err
; maybeAddDeferredHoleBinding ctxt err ct }
@@ -1010,8 +1010,8 @@ mkIrredErr ctxt cts
(ct1:_) = cts
----------------
-mkHoleError :: ReportErrCtxt -> Ct -> TcM ErrMsg
-mkHoleError _ctxt ct@(CHoleCan { cc_hole = ExprHole (OutOfScope occ rdr_env0) })
+mkHoleError :: [Ct] -> ReportErrCtxt -> Ct -> TcM ErrMsg
+mkHoleError _ _ ct@(CHoleCan { cc_hole = ExprHole (OutOfScope occ rdr_env0) })
-- Out-of-scope variables, like 'a', where 'a' isn't bound; suggest possible
-- in-scope variables in the message, and note inaccessible exact matches
= do { dflags <- getDynFlags
@@ -1073,7 +1073,7 @@ mkHoleError _ctxt ct@(CHoleCan { cc_hole = ExprHole (OutOfScope occ rdr_env0) })
th_end_ln = srcSpanEndLine th_loc
is_th_bind = th_loc `containsSpan` bind_loc
-mkHoleError ctxt ct@(CHoleCan { cc_hole = hole })
+mkHoleError tidy_simples ctxt ct@(CHoleCan { cc_hole = hole })
-- Explicit holes, like "_" or "_f"
= do { (ctxt, binds_msg, ct) <- relevantBindings False ctxt ct
-- The 'False' means "don't filter the bindings"; see Trac #8191
@@ -1084,7 +1084,7 @@ mkHoleError ctxt ct@(CHoleCan { cc_hole = hole })
= givenConstraintsMsg ctxt
| otherwise = empty
- ; sub_msg <- validSubstitutions ctxt ct
+ ; sub_msg <- validSubstitutions tidy_simples ctxt ct
; mkErrorMsgFromCt ctxt ct $
important hole_msg `mappend`
relevant_bindings (binds_msg $$ constraints_msg) `mappend`
@@ -1143,12 +1143,12 @@ mkHoleError ctxt ct@(CHoleCan { cc_hole = hole })
then quotes (ppr tv) <+> text "is a coercion variable"
else empty
-mkHoleError _ ct = pprPanic "mkHoleError" (ppr ct)
+mkHoleError _ _ ct = pprPanic "mkHoleError" (ppr ct)
-- See Note [Valid substitutions include ...]
-validSubstitutions :: ReportErrCtxt -> Ct -> TcM SDoc
-validSubstitutions (CEC {cec_encl = implics}) ct | isExprHoleCt ct =
+validSubstitutions :: [Ct] -> ReportErrCtxt -> Ct -> TcM SDoc
+validSubstitutions simples (CEC {cec_encl = implics}) ct | isExprHoleCt ct =
do { rdr_env <- getGlobalRdrEnv
; dflags <- getDynFlags
; traceTc "findingValidSubstitutionsFor {" $ ppr wrapped_hole_ty
@@ -1159,22 +1159,20 @@ validSubstitutions (CEC {cec_encl = implics}) ct | isExprHoleCt ct =
; traceTc "}" empty
; return $ ppUnless (null substitutions) $
hang (text "Valid substitutions include")
- 2 (vcat (map (ppr_sub rdr_env) substitutions)
+ 2 (vcat (map ppr_sub substitutions)
$$ ppWhen discards subsDiscardMsg) }
where
-- We extract the type of the hole from the constraint.
hole_ty :: TcPredType
- hole_ty = ctEvPred (ctEvidence ct)
+ hole_ty = ctPred ct
hole_loc = ctEvLoc $ ctEvidence ct
- hole_env = ctLocEnv $ hole_loc
hole_lvl = ctLocLevel $ hole_loc
-
+ hole_fvs = tyCoFVsOfType hole_ty
-- For checking, we wrap the type of the hole with all the givens
-- from all the implications in the context.
wrapped_hole_ty :: TcSigmaType
- wrapped_hole_ty = foldl' wrapType hole_ty implics
-
+ wrapped_hole_ty = foldl' wrapTypeWithImplication hole_ty implics
-- We rearrange the elements to make locals appear at the top of the list,
-- since they're most likely to be relevant to the user
@@ -1182,63 +1180,104 @@ validSubstitutions (CEC {cec_encl = implics}) ct | isExprHoleCt ct =
localsFirst elts = lcl ++ gbl
where (lcl, gbl) = partition gre_lcl elts
- is_id_bind :: TcBinder -> Bool
- is_id_bind (TcIdBndr {}) = True
- is_id_bind (TcIdBndr_ExpType {}) = True
- is_id_bind (TcTvBndr {}) = False
-
- -- The set of relevant bindings. We use it to make sure we don't repeat
- -- ids from the relevant bindings again in the suggestions.
- relBindSet :: OccSet
- relBindSet = mkOccSet [ occName b | b <- tcl_bndrs hole_env
- , is_id_bind b ]
-
- -- We skip elements that are already in the "Relevant Bindings Include"
- -- part of the error message, as given by the relBindSet.
- shouldBeSkipped :: GlobalRdrElt -> Bool
- shouldBeSkipped el = (occName $ gre_name el) `elemOccSet` relBindSet
-
-- For pretty printing, we look up the name and type of the substitution
-- we found.
- ppr_sub :: GlobalRdrEnv -> Id -> SDoc
- ppr_sub rdr_env id = case lookupGRE_Name rdr_env (idName id) of
- Just elt -> sep [ idAndTy, nest 2 (parens $ pprNameProvenance elt)]
- _ -> idAndTy
- where name = idName id
+ ppr_sub :: (GlobalRdrElt, Id) -> SDoc
+ ppr_sub (elt, id) = sep [ idAndTy , nest 2 (parens $ pprNameProvenance elt)]
+ where name = gre_name elt
ty = varType id
idAndTy = (pprPrefixOcc name <+> dcolon <+> pprType ty)
- -- The real work happens here, where we invoke the typechecker to check
- -- whether we the given type fits into the hole!
- substituteable :: Id -> TcM Bool
- substituteable id = wrapped_hole_ty `tcSubsumes` ty
- where ty = varType id
+ -- These are the constraints whose every free unification variable is
+ -- mentioned in the type of the hole.
+ relevantCts :: [Ct]
+ relevantCts = if isEmptyVarSet hole_fv then []
+ else filter isRelevant simples
+ where hole_fv :: VarSet
+ hole_fv = fvVarSet hole_fvs
+ ctFreeVarSet :: Ct -> VarSet
+ ctFreeVarSet = fvVarSet . tyCoFVsOfType . ctPred
+ allFVMentioned :: Ct -> Bool
+ allFVMentioned ct = ctFreeVarSet ct `subVarSet` hole_fv
+ -- We filter out those constraints that have no variables (since
+ -- they won't be solved by finding a type for the type variable
+ -- representing the hole) and also other holes, since we're not
+ -- trying to find substitutions for many holes at once.
+ isRelevant ct = not (isEmptyVarSet (ctFreeVarSet ct))
+ && allFVMentioned ct
+ && not (isHoleCt ct)
+
+
+ -- This creates a substitution with new fresh type variables for all the
+ -- free variables mentioned in the type of hole and in the relevant
+ -- constraints. Note that since we only pick constraints such that all their
+ -- free variables are mentioned by the hole, the free variables of the hole
+ -- are all the free variables of the constraints as well.
+ getHoleCloningSubst :: TcM TCvSubst
+ getHoleCloningSubst = mkTvSubstPrs <$> getClonedVars
+ where cloneFV :: TyVar -> TcM (TyVar, Type)
+ cloneFV fv = ((,) fv) <$> newFlexiTyVarTy (varType fv)
+ getClonedVars :: TcM [(TyVar, Type)]
+ getClonedVars = mapM cloneFV (fvVarList hole_fvs)
+
+ -- This applies the given substitution to the given constraint.
+ applySubToCt :: TCvSubst -> Ct -> Ct
+ applySubToCt sub ct = ct {cc_ev = ev {ctev_pred = subbedPredType} }
+ where subbedPredType = substTy sub $ ctPred ct
+ ev = ctEvidence ct
+
+ -- The real work happens here, where we invoke the type checker
+ -- to check whether we the given type fits into the hole!
+ -- To check: Clone all relevant cts and the hole
+ -- then solve the subsumption check AND check that all other
+ -- the other constraints were solved.
+ fitsHole :: Type -> TcM Bool
+ fitsHole typ =
+ do { traceTc "checkingFitOf {" $ ppr typ
+ ; cloneSub <- getHoleCloningSubst
+ ; let cHoleTy = substTy cloneSub wrapped_hole_ty
+ cCts = map (applySubToCt cloneSub) relevantCts
+ ; fits <- tcCheckHoleFit (listToBag cCts) cHoleTy typ
+ ; traceTc "}" empty
+ ; return fits}
-- Kickoff the checking of the elements. The first argument
- -- is a counter, so that we stop after finding functions up to the
- -- limit the user gives us.
- go :: Maybe Int -> [GlobalRdrElt] -> TcM (Bool, [Id])
+ -- is a counter, so that we stop after finding functions up to
+ -- the limit the user gives us.
+ go :: Maybe Int -> [GlobalRdrElt] -> TcM (Bool, [(GlobalRdrElt, Id)])
go = go_ []
- -- We iterate over the elements, checking each one in turn. If we've
- -- already found -fmax-valid-substitutions=n elements, we look no further.
- go_ :: [Id] -> Maybe Int -> [GlobalRdrElt] -> TcM (Bool, [Id])
+ -- We iterate over the elements, checking each one in turn. If
+ -- we've already found -fmax-valid-substitutions=n elements, we
+ -- look no further.
+ go_ :: [(GlobalRdrElt,Id)] -- What we've found so far.
+ -> Maybe Int -- How many we're allowed to find, if limited.
+ -> [GlobalRdrElt] -- The elements we've yet to check.
+ -> TcM (Bool, [(GlobalRdrElt, Id)])
go_ subs _ [] = return (False, reverse subs)
go_ subs (Just 0) _ = return (True, reverse subs)
go_ subs maxleft (el:elts) =
- if shouldBeSkipped el then discard_it
- else do { maybeId <- tcLookupIdMaybe (gre_name el)
- ; case maybeId of
- Just id -> do { canSub <- substituteable id
- ; if canSub then (keep_it id) else discard_it }
- _ -> discard_it
- }
+ do { traceTc "lookingUp" $ ppr el
+ ; maybeThing <- lookup (gre_name el)
+ ; case maybeThing of
+ Just id -> do { fits <- fitsHole (varType id)
+ ; if fits then (keep_it id) else discard_it }
+ _ -> discard_it
+ }
where discard_it = go_ subs maxleft elts
- keep_it id = go_ (id:subs) ((\n -> n - 1) <$> maxleft) elts
+ keep_it id = go_ ((el,id):subs) ((\n -> n - 1) <$> maxleft) elts
+ lookup name =
+ do { thing <- tcLookup name
+ ; case thing of
+ ATcId {tct_id = id} -> return $ Just id
+ AGlobal (AnId id) -> return $ Just id
+ AGlobal (AConLike (RealDataCon con)) ->
+ return $ Just (dataConWrapId con)
+ _ -> return Nothing }
-- We don't (as of yet) handle holes in types, only in expressions.
-validSubstitutions _ _ = return empty
+validSubstitutions _ _ _ = return empty
-- See Note [Constraints include ...]
@@ -1292,48 +1331,62 @@ For example, look at the following definitions in a file called test.hs:
The hole in `f` would generate the message:
- Valid substitutions include
- inits :: forall a. [a] -> [[a]]
- (imported from ‘Data.List’ at tp.hs:3:19-23
- (and originally defined in ‘base-4.10.0.0:Data.OldList’))
- fail :: forall (m :: * -> *). Monad m => forall a. String -> m a
- (imported from ‘Prelude’ at tp.hs:1:8-9
- (and originally defined in ‘GHC.Base’))
- mempty :: forall a. Monoid a => a
- (imported from ‘Prelude’ at tp.hs:1:8-9
- (and originally defined in ‘GHC.Base’))
- pure :: forall (f :: * -> *). Applicative f => forall a. a -> f a
- (imported from ‘Prelude’ at tp.hs:1:8-9
- (and originally defined in ‘GHC.Base’))
- return :: forall (m :: * -> *). Monad m => forall a. a -> m a
- (imported from ‘Prelude’ at tp.hs:1:8-9
- (and originally defined in ‘GHC.Base’))
- read :: forall a. Read a => String -> a
- (imported from ‘Prelude’ at tp.hs:1:8-9
- (and originally defined in ‘Text.Read’))
- lines :: String -> [String]
- (imported from ‘Prelude’ at tp.hs:1:8-9
- (and originally defined in ‘base-4.10.0.0:Data.OldList’))
- words :: String -> [String]
- (imported from ‘Prelude’ at tp.hs:1:8-9
- (and originally defined in ‘base-4.10.0.0:Data.OldList’))
- error :: forall (a :: TYPE r). GHC.Stack.Types.HasCallStack => [Char] -> a
- (imported from ‘Prelude’ at tp.hs:1:8-9
- (and originally defined in ‘GHC.Err’))
- errorWithoutStackTrace :: forall (a :: TYPE r). [Char] -> a
- (imported from ‘Prelude’ at tp.hs:1:8-9
- (and originally defined in ‘GHC.Err’))
- undefined :: forall (a :: TYPE r). GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at tp.hs:1:8-9
- (and originally defined in ‘GHC.Err’))
- repeat :: forall a. a -> [a]
- (imported from ‘Prelude’ at tp.hs:1:8-9
- (and originally defined in ‘GHC.List’))
-
-Valid substitutions are found by checking top level ids in scope, and checking
-whether their type subsumes the type of the hole. We remove ids that are
-local bindings, since they are already included in the relevant bindings
-section of the hole error message.
+ • Found hole: _ :: [Char] -> [String]
+ • In the expression: _
+ In the expression: _ "hello, world"
+ In an equation for ‘f’: f = _ "hello, world"
+ • Relevant bindings include f :: [String] (bound at test.hs:6:1)
+ Valid substitutions include
+ inits :: forall a. [a] -> [[a]]
+ (imported from ‘Data.List’ at test.hs:3:19-23
+ (and originally defined in ‘base-4.11.0.0:Data.OldList’))
+ return :: forall (m :: * -> *). Monad m => forall a. a -> m a
+ (imported from ‘Prelude’ at test.hs:1:8-11
+ (and originally defined in ‘GHC.Base’))
+ fail :: forall (m :: * -> *). Monad m => forall a. String -> m a
+ (imported from ‘Prelude’ at test.hs:1:8-11
+ (and originally defined in ‘GHC.Base’))
+ mempty :: forall a. Monoid a => a
+ (imported from ‘Prelude’ at test.hs:1:8-11
+ (and originally defined in ‘GHC.Base’))
+ pure :: forall (f :: * -> *). Applicative f => forall a. a -> f a
+ (imported from ‘Prelude’ at test.hs:1:8-11
+ (and originally defined in ‘GHC.Base’))
+ read :: forall a. Read a => String -> a
+ (imported from ‘Prelude’ at test.hs:1:8-11
+ (and originally defined in ‘Text.Read’))
+ lines :: String -> [String]
+ (imported from ‘Prelude’ at test.hs:1:8-11
+ (and originally defined in ‘base-4.11.0.0:Data.OldList’))
+ words :: String -> [String]
+ (imported from ‘Prelude’ at test.hs:1:8-11
+ (and originally defined in ‘base-4.11.0.0:Data.OldList’))
+ error :: forall (a :: TYPE r). GHC.Stack.Types.HasCallStack => [Char] -> a
+ (imported from ‘Prelude’ at test.hs:1:8-11
+ (and originally defined in ‘GHC.Err’))
+ errorWithoutStackTrace :: forall (a :: TYPE r). [Char] -> a
+ (imported from ‘Prelude’ at test.hs:1:8-11
+ (and originally defined in ‘GHC.Err’))
+ undefined :: forall (a :: TYPE r). GHC.Stack.Types.HasCallStack => a
+ (imported from ‘Prelude’ at test.hs:1:8-11
+ (and originally defined in ‘GHC.Err’))
+ repeat :: forall a. a -> [a]
+ (imported from ‘Prelude’ at test.hs:1:8-11
+ (and originally defined in ‘GHC.List’))
+
+Valid substitutions are found by checking top level identifiers in scope for
+whether their type is subsumed by the type of the hole. Additionally, as
+highlighted by Trac #14273, we also need to check whether all relevant
+constraints are solved by choosing an identifier of that type as well. This is
+to make sure we don't suggest a substitution which does not fulfill the
+constraints imposed on the hole (even though it has a type that would otherwise
+fit the hole). The relevant constraints are those whose free unification
+variables are all mentioned by the type of the hole. Since checking for
+subsumption results in the side effect of type variables being unified by the
+simplifier, we need to take care to clone the variables in the hole and relevant
+constraints before checking whether an identifier fits into the hole, to avoid
+affecting the hole and later checks.
+
Note [Constraints include ...]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs
index 7766a38aa1..5e97935f55 100644
--- a/compiler/typecheck/TcRnTypes.hs
+++ b/compiler/typecheck/TcRnTypes.hs
@@ -113,7 +113,7 @@ module TcRnTypes(
isWanted, isGiven, isDerived, isGivenOrWDeriv,
ctEvRole,
- wrapType,
+ wrapType, wrapTypeWithImplication,
-- Constraint solver plugins
TcPlugin(..), TcPluginResult(..), TcPluginSolver,
@@ -2564,13 +2564,18 @@ pprEvVarWithType v = ppr v <+> dcolon <+> pprType (evVarPred v)
-- | Wraps the given type with the constraints (via ic_given) in the given
-- implication, according to the variables mentioned (via ic_skols)
-- in the implication.
-wrapType :: Type -> Implication -> Type
-wrapType ty (Implic {ic_skols = skols, ic_given=givens}) =
- wrapWithAllSkols $ mkFunTys (map idType givens) $ ty
+wrapTypeWithImplication :: Type -> Implication -> Type
+wrapTypeWithImplication ty impl =
+ wrapType ty (ic_skols impl) (map idType $ ic_given impl)
+
+wrapType :: Type -> [TyVar] -> [PredType] -> Type
+wrapType ty skols givens =
+ wrapWithAllSkols $ mkFunTys givens ty
where forAllTy :: Type -> TyVar -> Type
forAllTy ty tv = mkForAllTy tv Specified ty
wrapWithAllSkols ty = foldl forAllTy ty skols
+
{-
************************************************************************
* *
diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs
index 942a40a43e..70c8f96d90 100644
--- a/compiler/typecheck/TcSimplify.hs
+++ b/compiler/typecheck/TcSimplify.hs
@@ -10,6 +10,7 @@ module TcSimplify(
simplifyWantedsTcM,
tcCheckSatisfiability,
tcSubsumes,
+ tcCheckHoleFit,
-- For Rules we need these
solveWanteds, solveWantedsAndDrop,
@@ -488,11 +489,18 @@ simplifyDefault theta
-- N.B.: Make sure that the types contain all the constraints
-- contained in any associated implications.
tcSubsumes :: TcSigmaType -> TcSigmaType -> TcM Bool
-tcSubsumes ty_a ty_b | ty_a `eqType` ty_b = return True
-tcSubsumes ty_a ty_b = discardErrs $
+tcSubsumes = tcCheckHoleFit emptyBag
+
+
+-- | A tcSubsumes which takes into account relevant constraints, to fix trac
+-- #14273. Make sure that the constraints are cloned, since the simplifier may
+-- perform unification
+tcCheckHoleFit :: Cts -> TcSigmaType -> TcSigmaType -> TcM Bool
+tcCheckHoleFit _ hole_ty ty | hole_ty `eqType` ty = return True
+tcCheckHoleFit relevantCts hole_ty ty = discardErrs $
do { (_, wanted, _) <- pushLevelAndCaptureConstraints $
- tcSubType_NC ExprSigCtxt ty_b ty_a
- ; (rem, _) <- runTcS (simpl_top wanted)
+ tcSubType_NC ExprSigCtxt ty hole_ty
+ ; (rem, _) <- runTcS (simpl_top $ addSimples wanted relevantCts)
-- We don't want any insoluble or simple constraints left,
-- but solved implications are ok (and neccessary for e.g. undefined)
; return (isEmptyBag (wc_simple rem)
diff --git a/compiler/typecheck/TcSimplify.hs-boot b/compiler/typecheck/TcSimplify.hs-boot
index a131bb3e82..979894ce3a 100644
--- a/compiler/typecheck/TcSimplify.hs-boot
+++ b/compiler/typecheck/TcSimplify.hs-boot
@@ -1,9 +1,9 @@
module TcSimplify where
import GhcPrelude
-import TcRnTypes ( TcM )
+import TcRnTypes ( TcM, Cts )
import TcType ( TcSigmaType )
--- This boot file exists solely to make tcSubsume avaialble in TcErrors
+-- This boot file exists solely to make tcCheckHoleFit avaialble in TcErrors
-tcSubsumes :: TcSigmaType -> TcSigmaType -> TcM Bool
+tcCheckHoleFit :: Cts -> TcSigmaType -> TcSigmaType -> TcM Bool
diff --git a/testsuite/tests/ghci/scripts/T8353.stderr b/testsuite/tests/ghci/scripts/T8353.stderr
index 766fc1eb62..c2df017ee3 100644
--- a/testsuite/tests/ghci/scripts/T8353.stderr
+++ b/testsuite/tests/ghci/scripts/T8353.stderr
@@ -10,6 +10,7 @@ Defer03.hs:7:5: warning: [-Wtyped-holes (in -Wdefault)]
In an equation for ‘f’: f = _
• Relevant bindings include f :: Int (bound at Defer03.hs:7:1)
Valid substitutions include
+ f :: Int (defined at Defer03.hs:7:1)
a :: Int (defined at Defer03.hs:4:1)
undefined :: forall (a :: TYPE r).
GHC.Stack.Types.HasCallStack =>
@@ -34,6 +35,7 @@ Defer03.hs:7:5: error:
In an equation for ‘f’: f = _
• Relevant bindings include f :: Int (bound at Defer03.hs:7:1)
Valid substitutions include
+ f :: Int (defined at Defer03.hs:7:1)
a :: Int (defined at Defer03.hs:4:1)
undefined :: forall (a :: TYPE r).
GHC.Stack.Types.HasCallStack =>
@@ -58,6 +60,7 @@ Defer03.hs:7:5: warning: [-Wtyped-holes (in -Wdefault)]
In an equation for ‘f’: f = _
• Relevant bindings include f :: Int (bound at Defer03.hs:7:1)
Valid substitutions include
+ f :: Int (defined at Defer03.hs:7:1)
a :: Int (defined at Defer03.hs:4:1)
undefined :: forall (a :: TYPE r).
GHC.Stack.Types.HasCallStack =>
@@ -82,6 +85,7 @@ Defer03.hs:7:5: error:
In an equation for ‘f’: f = _
• Relevant bindings include f :: Int (bound at Defer03.hs:7:1)
Valid substitutions include
+ f :: Int (defined at Defer03.hs:7:1)
a :: Int (defined at Defer03.hs:4:1)
undefined :: forall (a :: TYPE r).
GHC.Stack.Types.HasCallStack =>
@@ -106,6 +110,7 @@ Defer03.hs:7:5: warning: [-Wtyped-holes (in -Wdefault)]
In an equation for ‘f’: f = _
• Relevant bindings include f :: Int (bound at Defer03.hs:7:1)
Valid substitutions include
+ f :: Int (defined at Defer03.hs:7:1)
a :: Int (defined at Defer03.hs:4:1)
undefined :: forall (a :: TYPE r).
GHC.Stack.Types.HasCallStack =>
diff --git a/testsuite/tests/th/T10267.stderr b/testsuite/tests/th/T10267.stderr
index 0ac32fad1c..ca650c3eba 100644
--- a/testsuite/tests/th/T10267.stderr
+++ b/testsuite/tests/th/T10267.stderr
@@ -29,6 +29,8 @@ T10267.hs:8:1: error:
• Relevant bindings include i :: a -> a (bound at T10267.hs:8:1)
Valid substitutions include
l :: forall a. a -> a (defined at T10267.hs:23:3)
+ i :: forall a. a -> a (defined at T10267.hs:8:1)
+ j :: forall a. a -> a (defined at T10267.hs:8:1)
k :: forall a. a -> a (defined at T10267.hs:14:3)
foo :: forall a. a -> a (defined at T10267.hs:33:1)
id :: forall a. a -> a
@@ -52,6 +54,9 @@ T10267.hs:14:3: error:
• Relevant bindings include k :: a -> a (bound at T10267.hs:14:3)
Valid substitutions include
l :: forall a. a -> a (defined at T10267.hs:23:3)
+ i :: forall a. a -> a (defined at T10267.hs:8:1)
+ j :: forall a. a -> a (defined at T10267.hs:8:1)
+ k :: forall a. a -> a (defined at T10267.hs:14:3)
foo :: forall a. a -> a (defined at T10267.hs:33:1)
id :: forall a. a -> a
(imported from ‘Prelude’ at T10267.hs:3:8-13
diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T
index 1fae4c6af8..2e7ffa3368 100644
--- a/testsuite/tests/th/all.T
+++ b/testsuite/tests/th/all.T
@@ -305,7 +305,7 @@ test('TH_Lift', normal, compile, ['-v0'])
test('T10047', only_ways(['ghci']), ghci_script, ['T10047.script'])
test('T10019', only_ways(['ghci']), ghci_script, ['T10019.script'])
test('T10267', [], multimod_compile_fail,
- ['T10267', '-dsuppress-uniques -v0 ' + config.ghc_th_way_flags])
+ ['T10267', '-fno-max-valid-substitutions -dsuppress-uniques -v0 ' + config.ghc_th_way_flags])
test('T10279', normal, compile_fail, ['-v0'])
test('T10306', normal, compile, ['-v0'])
test('T10596', normal, compile, ['-v0'])
diff --git a/testsuite/tests/typecheck/should_compile/T13050.stderr b/testsuite/tests/typecheck/should_compile/T13050.stderr
index 4f9410ed80..dc21803811 100644
--- a/testsuite/tests/typecheck/should_compile/T13050.stderr
+++ b/testsuite/tests/typecheck/should_compile/T13050.stderr
@@ -9,6 +9,9 @@ T13050.hs:4:9: warning: [-Wtyped-holes (in -Wdefault)]
x :: Int (bound at T13050.hs:4:3)
f :: Int -> Int -> Int (bound at T13050.hs:4:1)
Valid substitutions include
+ f :: Int -> Int -> Int (defined at T13050.hs:4:1)
+ g :: Int -> Int -> Int (defined at T13050.hs:5:1)
+ q :: Int -> Int -> Int (defined at T13050.hs:6:1)
(-) :: forall a. Num a => a -> a -> a
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Num’))
@@ -74,6 +77,8 @@ T13050.hs:5:11: warning: [-Wtyped-holes (in -Wdefault)]
g :: Int -> Int -> Int (bound at T13050.hs:5:1)
Valid substitutions include
f :: Int -> Int -> Int (defined at T13050.hs:4:1)
+ g :: Int -> Int -> Int (defined at T13050.hs:5:1)
+ q :: Int -> Int -> Int (defined at T13050.hs:6:1)
(-) :: forall a. Num a => a -> a -> a
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Num’))
@@ -141,6 +146,7 @@ T13050.hs:6:11: warning: [-Wtyped-holes (in -Wdefault)]
Valid substitutions include
f :: Int -> Int -> Int (defined at T13050.hs:4:1)
g :: Int -> Int -> Int (defined at T13050.hs:5:1)
+ q :: Int -> Int -> Int (defined at T13050.hs:6:1)
(-) :: forall a. Num a => a -> a -> a
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Num’))
diff --git a/testsuite/tests/typecheck/should_compile/T14273.hs b/testsuite/tests/typecheck/should_compile/T14273.hs
new file mode 100644
index 0000000000..b813237120
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T14273.hs
@@ -0,0 +1,13 @@
+module TypeClassConstraintsInformedHoles where
+
+-- Make sure that constraints imposed by the call site
+-- are handled. See trac #14273
+pleaseShow :: Show a => Bool -> a -> Maybe String
+pleaseShow False _ = Nothing
+pleaseShow True a = Just (show _a)
+
+k :: String
+k = "I fit into the hole in foo!"
+
+foo :: [a] -> String
+foo xs = show (_h ++ [])
diff --git a/testsuite/tests/typecheck/should_compile/T14273.stderr b/testsuite/tests/typecheck/should_compile/T14273.stderr
new file mode 100644
index 0000000000..49df4b15cf
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T14273.stderr
@@ -0,0 +1,80 @@
+
+T14273.hs:7:27: warning: [-Wdeferred-type-errors (in -Wdefault)]
+ • Could not deduce (Show a1) arising from a use of ‘show’
+ from the context: Show a
+ bound by the type signature for:
+ 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:
+ instance (Show a, Show b) => Show (Either a b)
+ -- Defined in ‘Data.Either’
+ instance Show Ordering -- Defined in ‘GHC.Show’
+ instance Show Integer -- Defined in ‘GHC.Show’
+ ...plus 23 others
+ ...plus 67 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)
+ In an equation for ‘pleaseShow’: pleaseShow True a = Just (show _a)
+
+T14273.hs:7:32: warning: [-Wtyped-holes (in -Wdefault)]
+ • Found hole: _a :: a1
+ Where: ‘a1’ is an ambiguous type variable
+ Or perhaps ‘_a’ is mis-spelled, or not in scope
+ • In the first argument of ‘show’, namely ‘_a’
+ In the first argument of ‘Just’, namely ‘(show _a)’
+ In the expression: Just (show _a)
+ • Relevant bindings include
+ a :: a (bound at T14273.hs:7:17)
+ pleaseShow :: Bool -> a -> Maybe String (bound at T14273.hs:6:1)
+ Valid substitutions include
+ k :: String (defined at T14273.hs:10:1)
+ False :: Bool
+ (imported from ‘Prelude’ at T14273.hs:1:8-40
+ (and originally defined in ‘GHC.Types’))
+ True :: Bool
+ (imported from ‘Prelude’ at T14273.hs:1:8-40
+ (and originally defined in ‘GHC.Types’))
+ LT :: Ordering
+ (imported from ‘Prelude’ at T14273.hs:1:8-40
+ (and originally defined in ‘GHC.Types’))
+ EQ :: Ordering
+ (imported from ‘Prelude’ at T14273.hs:1:8-40
+ (and originally defined in ‘GHC.Types’))
+ GT :: Ordering
+ (imported from ‘Prelude’ at T14273.hs:1:8-40
+ (and originally defined in ‘GHC.Types’))
+ otherwise :: Bool
+ (imported from ‘Prelude’ at T14273.hs:1:8-40
+ (and originally defined in ‘GHC.Base’))
+ pi :: forall a. Floating a => a
+ (imported from ‘Prelude’ at T14273.hs:1:8-40
+ (and originally defined in ‘GHC.Float’))
+
+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:
+ instance (Show a, Show b) => Show (Either a b)
+ -- Defined in ‘Data.Either’
+ instance Show Ordering -- Defined in ‘GHC.Show’
+ instance Show Integer -- Defined in ‘GHC.Show’
+ ...plus 23 others
+ ...plus 67 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 ++ [])
+
+T14273.hs:13:16: warning: [-Wtyped-holes (in -Wdefault)]
+ • Found hole: _h :: [a0]
+ Where: ‘a0’ is an ambiguous type variable
+ Or perhaps ‘_h’ is mis-spelled, or not in scope
+ • In the first argument of ‘(++)’, namely ‘_h’
+ In the first argument of ‘show’, namely ‘(_h ++ [])’
+ In the expression: show (_h ++ [])
+ • Relevant bindings include
+ xs :: [a] (bound at T14273.hs:13:5)
+ foo :: [a] -> String (bound at T14273.hs:13:1)
+ Valid substitutions include k :: String (defined at T14273.hs:10:1)
diff --git a/testsuite/tests/typecheck/should_compile/T14590.stderr b/testsuite/tests/typecheck/should_compile/T14590.stderr
index ee186d06e7..ff441993ec 100644
--- a/testsuite/tests/typecheck/should_compile/T14590.stderr
+++ b/testsuite/tests/typecheck/should_compile/T14590.stderr
@@ -9,6 +9,10 @@ T14590.hs:4:13: warning: [-Wtyped-holes (in -Wdefault)]
x :: Int (bound at T14590.hs:4:4)
f1 :: Int -> Int -> Int (bound at T14590.hs:4:1)
Valid substitutions include
+ f1 :: Int -> Int -> Int (defined at T14590.hs:4:1)
+ f2 :: Int -> Int -> Int (defined at T14590.hs:5:1)
+ f3 :: Int -> Int -> Int (defined at T14590.hs:6:1)
+ f4 :: Int -> Int -> Int (defined at T14590.hs:7:1)
(-) :: forall a. Num a => a -> a -> a
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Num’))
@@ -75,6 +79,9 @@ T14590.hs:5:13: warning: [-Wtyped-holes (in -Wdefault)]
f2 :: Int -> Int -> Int (bound at T14590.hs:5:1)
Valid substitutions include
f1 :: Int -> Int -> Int (defined at T14590.hs:4:1)
+ f2 :: Int -> Int -> Int (defined at T14590.hs:5:1)
+ f3 :: Int -> Int -> Int (defined at T14590.hs:6:1)
+ f4 :: Int -> Int -> Int (defined at T14590.hs:7:1)
(-) :: forall a. Num a => a -> a -> a
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Num’))
@@ -141,6 +148,8 @@ T14590.hs:6:11: warning: [-Wtyped-holes (in -Wdefault)]
Valid substitutions include
f1 :: Int -> Int -> Int (defined at T14590.hs:4:1)
f2 :: Int -> Int -> Int (defined at T14590.hs:5:1)
+ f3 :: Int -> Int -> Int (defined at T14590.hs:6:1)
+ f4 :: Int -> Int -> Int (defined at T14590.hs:7:1)
(-) :: forall a. Num a => a -> a -> a
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Num’))
@@ -209,6 +218,7 @@ T14590.hs:7:11: warning: [-Wtyped-holes (in -Wdefault)]
f1 :: Int -> Int -> Int (defined at T14590.hs:4:1)
f2 :: Int -> Int -> Int (defined at T14590.hs:5:1)
f3 :: Int -> Int -> Int (defined at T14590.hs:6:1)
+ f4 :: Int -> Int -> Int (defined at T14590.hs:7:1)
(-) :: forall a. Num a => a -> a -> a
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Num’))
diff --git a/testsuite/tests/typecheck/should_compile/T9497a.stderr b/testsuite/tests/typecheck/should_compile/T9497a.stderr
index 413aad24b6..540bdf55ea 100644
--- a/testsuite/tests/typecheck/should_compile/T9497a.stderr
+++ b/testsuite/tests/typecheck/should_compile/T9497a.stderr
@@ -6,6 +6,7 @@ T9497a.hs:2:8: warning: [-Wtyped-holes (in -Wdefault)]
In an equation for ‘main’: main = _main
• Relevant bindings include main :: IO () (bound at T9497a.hs:2:1)
Valid substitutions include
+ main :: IO () (defined at T9497a.hs:2:1)
mempty :: forall a. Monoid a => a
(imported from ‘Prelude’ at T9497a.hs:1:1
(and originally defined in ‘GHC.Base’))
diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T
index 2a89eb3931..49df11b024 100644
--- a/testsuite/tests/typecheck/should_compile/all.T
+++ b/testsuite/tests/typecheck/should_compile/all.T
@@ -390,6 +390,7 @@ test('hole_constraints', normal, compile, ['-fdefer-type-errors -fno-max-valid-s
test('hole_constraints_nested', normal, compile, ['-fdefer-type-errors -fno-max-valid-substitutions'])
test('valid_substitutions', [extra_files(['ValidSubs.hs'])],
multimod_compile, ['valid_substitutions','-fdefer-type-errors -fno-max-valid-substitutions'])
+test('valid_substitutions_interactions', normal, compile, ['-fdefer-type-errors -fno-max-valid-substitutions'])
test('T7408', normal, compile, [''])
test('UnboxStrictPrimitiveFields', normal, compile, [''])
test('T7541', normal, compile, [''])
@@ -588,3 +589,4 @@ test('MissingExportList02', normal, compile, [''])
test('T14488', normal, compile, [''])
test('T14590', normal, compile, ['-fdefer-type-errors -fno-max-valid-substitutions'])
test('T13032', normal, compile, [''])
+test('T14273', normal, compile, ['-fdefer-type-errors -fno-max-valid-substitutions'])
diff --git a/testsuite/tests/typecheck/should_compile/hole_constraints.stderr b/testsuite/tests/typecheck/should_compile/hole_constraints.stderr
index 98d76ce805..d8ca78d901 100644
--- a/testsuite/tests/typecheck/should_compile/hole_constraints.stderr
+++ b/testsuite/tests/typecheck/should_compile/hole_constraints.stderr
@@ -11,6 +11,7 @@ hole_constraints.hs:8:6: warning: [-Wtyped-holes (in -Wdefault)]
f1 :: a (bound at hole_constraints.hs:8:1)
Constraints include Eq a (from hole_constraints.hs:7:1-15)
Valid substitutions include
+ f1 :: forall a. Eq a => a (defined at hole_constraints.hs:8:1)
undefined :: forall (a :: TYPE r).
GHC.Stack.Types.HasCallStack =>
a
@@ -32,6 +33,8 @@ hole_constraints.hs:12:6: warning: [-Wtyped-holes (in -Wdefault)]
Eq a (from hole_constraints.hs:11:1-25)
Valid substitutions include
f1 :: forall a. Eq a => a (defined at hole_constraints.hs:8:1)
+ f2 :: forall a. (Show a, Eq a) => a
+ (defined at hole_constraints.hs:12:1)
undefined :: forall (a :: TYPE r).
GHC.Stack.Types.HasCallStack =>
a
@@ -41,7 +44,8 @@ hole_constraints.hs:12:6: warning: [-Wtyped-holes (in -Wdefault)]
hole_constraints.hs:16:35: warning: [-Wtyped-holes (in -Wdefault)]
• Found hole: _ :: [a]
Where: ‘a’ is a rigid type variable bound by
- the instance declaration at hole_constraints.hs:16:10-22
+ the instance declaration
+ at hole_constraints.hs:16:10-22
• In the expression: _
In an equation for ‘f3’: f3 = _
In the instance declaration for ‘C [a]’
@@ -49,6 +53,8 @@ hole_constraints.hs:16:35: warning: [-Wtyped-holes (in -Wdefault)]
f3 :: [a] (bound at hole_constraints.hs:16:30)
Constraints include Eq a (from hole_constraints.hs:16:10-22)
Valid substitutions include
+ f1 :: forall a. Eq a => a (defined at hole_constraints.hs:8:1)
+ f3 :: forall a. C a => a (defined at hole_constraints.hs:15:17)
mempty :: forall a. Monoid a => a
(imported from ‘Prelude’ at hole_constraints.hs:3:8-22
(and originally defined in ‘GHC.Base’))
diff --git a/testsuite/tests/typecheck/should_compile/holes.stderr b/testsuite/tests/typecheck/should_compile/holes.stderr
index 16d8ab794f..688a2dd8b8 100644
--- a/testsuite/tests/typecheck/should_compile/holes.stderr
+++ b/testsuite/tests/typecheck/should_compile/holes.stderr
@@ -2,11 +2,13 @@
holes.hs:3:5: warning: [-Wtyped-holes (in -Wdefault)]
• Found hole: _ :: t
Where: ‘t’ is a rigid type variable bound by
- the inferred type of f :: t at holes.hs:3:1-5
+ the inferred type of f :: t
+ at holes.hs:3:1-5
• In the expression: _
In an equation for ‘f’: f = _
• Relevant bindings include f :: t (bound at holes.hs:3:1)
Valid substitutions include
+ f :: forall t. t (defined at holes.hs:3:1)
undefined :: forall (a :: TYPE r).
GHC.Stack.Types.HasCallStack =>
a
@@ -42,6 +44,7 @@ holes.hs:8:5: warning: [-Wtyped-holes (in -Wdefault)]
• Relevant bindings include h :: [Char] (bound at holes.hs:8:1)
Valid substitutions include
f :: forall t. t (defined at holes.hs:3:1)
+ h :: [Char] (defined at holes.hs:8:1)
mempty :: forall a. Monoid a => a
(imported from ‘Prelude’ at holes.hs:1:8-12
(and originally defined in ‘GHC.Base’))
@@ -63,11 +66,450 @@ holes.hs:11:15: warning: [-Wtyped-holes (in -Wdefault)]
Valid substitutions include
f :: forall t. t (defined at holes.hs:3:1)
g :: Int -> Char (defined at holes.hs:6:1)
- toEnum :: forall a. Enum a => Int -> a
+ h :: [Char] (defined at holes.hs:8:1)
+ z :: forall a. [a] -> [a] (defined at holes.hs:11:1)
+ Left :: forall a b. a -> Either a b
(imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.Enum’))
+ (and originally defined in ‘Data.Either’))
+ Right :: forall a b. b -> Either a b
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘Data.Either’))
+ False :: Bool
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Types’))
+ True :: Bool
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Types’))
+ Nothing :: forall a. Maybe a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Base’))
+ Just :: forall a. a -> Maybe a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Base’))
+ LT :: Ordering
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Types’))
+ EQ :: Ordering
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Types’))
+ GT :: Ordering
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Types’))
+ (-) :: forall a. Num a => a -> a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Num’))
+ (.) :: forall b c a. (b -> c) -> (a -> b) -> a -> c
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Base’))
+ (++) :: forall a. [a] -> [a] -> [a]
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Base’))
+ const :: forall a b. a -> b -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Base’))
+ either :: forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘Data.Either’))
+ maybe :: forall b a. b -> (a -> b) -> Maybe a -> b
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘Data.Maybe’))
+ curry :: forall a b c. ((a, b) -> c) -> a -> b -> c
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘Data.Tuple’))
+ fst :: forall a b. (a, b) -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘Data.Tuple’))
+ snd :: forall a b. (a, b) -> b
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘Data.Tuple’))
+ uncurry :: forall a b c. (a -> b -> c) -> (a, b) -> c
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘Data.Tuple’))
+ ($) :: forall a (b :: TYPE r). (a -> b) -> a -> b
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Base’))
+ ($!) :: forall a b. (a -> b) -> a -> b
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Base’))
+ asTypeOf :: forall a. a -> a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Base’))
+ flip :: forall a b c. (a -> b -> c) -> b -> a -> c
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Base’))
+ id :: forall a. a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Base’))
+ map :: forall a b. (a -> b) -> [a] -> [b]
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Base’))
+ otherwise :: Bool
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Base’))
+ until :: forall a. (a -> Bool) -> (a -> a) -> a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Base’))
+ (**) :: forall a. Floating a => a -> a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ acos :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ acosh :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ asin :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ asinh :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ atan :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ atan2 :: forall a. RealFloat a => a -> a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ atanh :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ cos :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ cosh :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ decodeFloat :: forall a. RealFloat a => a -> (Integer, Int)
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ encodeFloat :: forall a. RealFloat a => Integer -> Int -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ exp :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ exponent :: forall a. RealFloat a => a -> Int
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ floatDigits :: forall a. RealFloat a => a -> Int
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ floatRadix :: forall a. RealFloat a => a -> Integer
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ floatRange :: forall a. RealFloat a => a -> (Int, Int)
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ isDenormalized :: forall a. RealFloat a => a -> Bool
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ isIEEE :: forall a. RealFloat a => a -> Bool
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ isInfinite :: forall a. RealFloat a => a -> Bool
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ isNaN :: forall a. RealFloat a => a -> Bool
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ isNegativeZero :: forall a. RealFloat a => a -> Bool
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ log :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ logBase :: forall a. Floating a => a -> a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ pi :: forall a. Floating a => a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ scaleFloat :: forall a. RealFloat a => Int -> a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ significand :: forall a. RealFloat a => a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ sin :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ sinh :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ sqrt :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ tan :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ tanh :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Float’))
+ (*) :: forall a. Num a => a -> a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Num’))
+ (+) :: forall a. Num a => a -> a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Num’))
+ abs :: forall a. Num a => a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Num’))
+ fromInteger :: forall a. Num a => Integer -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Num’))
+ negate :: forall a. Num a => a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Num’))
+ signum :: forall a. Num a => a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Num’))
+ subtract :: forall a. Num a => a -> a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Num’))
+ (/) :: forall a. Fractional a => a -> a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Real’))
+ (^) :: forall a b. (Num a, Integral b) => a -> b -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Real’))
+ (^^) :: forall a b. (Fractional a, Integral b) => a -> b -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Real’))
+ ceiling :: forall a. RealFrac a => forall b. Integral b => a -> b
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Real’))
+ div :: forall a. Integral a => a -> a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Real’))
+ divMod :: forall a. Integral a => a -> a -> (a, a)
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Real’))
+ even :: forall a. Integral a => a -> Bool
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Real’))
+ floor :: forall a. RealFrac a => forall b. Integral b => a -> b
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Real’))
+ fromIntegral :: forall a b. (Integral a, Num b) => a -> b
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Real’))
+ fromRational :: forall a. Fractional a => Rational -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Real’))
+ gcd :: forall a. Integral a => a -> a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Real’))
+ lcm :: forall a. Integral a => a -> a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Real’))
+ mod :: forall a. Integral a => a -> a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Real’))
+ odd :: forall a. Integral a => a -> Bool
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Real’))
+ properFraction :: forall a.
+ RealFrac a =>
+ forall b. Integral b => a -> (b, a)
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Real’))
+ quot :: forall a. Integral a => a -> a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Real’))
+ quotRem :: forall a. Integral a => a -> a -> (a, a)
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Real’))
+ realToFrac :: forall a b. (Real a, Fractional b) => a -> b
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Real’))
+ recip :: forall a. Fractional a => a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Real’))
+ rem :: forall a. Integral a => a -> a -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Real’))
+ round :: forall a. RealFrac a => forall b. Integral b => a -> b
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Real’))
+ toInteger :: forall a. Integral a => a -> Integer
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Real’))
+ toRational :: forall a. Real a => a -> Rational
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Real’))
+ truncate :: forall a. RealFrac a => forall b. Integral b => a -> b
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Real’))
+ showChar :: Char -> ShowS
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Show’))
+ showParen :: Bool -> ShowS -> ShowS
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Show’))
+ showString :: String -> ShowS
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Show’))
+ appendFile :: FilePath -> String -> IO ()
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘System.IO’))
+ getChar :: IO Char
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘System.IO’))
+ getContents :: IO String
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘System.IO’))
+ getLine :: IO String
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘System.IO’))
+ interact :: (String -> String) -> IO ()
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘System.IO’))
+ putChar :: Char -> IO ()
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘System.IO’))
+ putStr :: String -> IO ()
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘System.IO’))
+ putStrLn :: String -> IO ()
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘System.IO’))
+ readFile :: FilePath -> IO String
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘System.IO’))
+ writeFile :: FilePath -> String -> IO ()
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘System.IO’))
+ lines :: String -> [String]
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘base-4.11.0.0:Data.OldList’))
+ unlines :: [String] -> String
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘base-4.11.0.0:Data.OldList’))
+ unwords :: [String] -> String
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘base-4.11.0.0:Data.OldList’))
+ words :: String -> [String]
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘base-4.11.0.0:Data.OldList’))
+ error :: forall (a :: TYPE r).
+ GHC.Stack.Types.HasCallStack =>
+ [Char] -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Err’))
+ errorWithoutStackTrace :: forall (a :: TYPE r). [Char] -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Err’))
undefined :: forall (a :: TYPE r).
GHC.Stack.Types.HasCallStack =>
a
(imported from ‘Prelude’ at holes.hs:1:8-12
(and originally defined in ‘GHC.Err’))
+ ioError :: forall a. IOError -> IO a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.IO.Exception’))
+ userError :: String -> IOError
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.IO.Exception’))
+ (!!) :: forall a. [a] -> Int -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ break :: forall a. (a -> Bool) -> [a] -> ([a], [a])
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ cycle :: forall a. [a] -> [a]
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ drop :: forall a. Int -> [a] -> [a]
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ dropWhile :: forall a. (a -> Bool) -> [a] -> [a]
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ head :: forall a. [a] -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ init :: forall a. [a] -> [a]
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ iterate :: forall a. (a -> a) -> a -> [a]
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ last :: forall a. [a] -> a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ repeat :: forall a. a -> [a]
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ replicate :: forall a. Int -> a -> [a]
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ reverse :: forall a. [a] -> [a]
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ scanl :: forall b a. (b -> a -> b) -> b -> [a] -> [b]
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ scanl1 :: forall a. (a -> a -> a) -> [a] -> [a]
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ scanr :: forall a b. (a -> b -> b) -> b -> [a] -> [b]
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ scanr1 :: forall a. (a -> a -> a) -> [a] -> [a]
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ span :: forall a. (a -> Bool) -> [a] -> ([a], [a])
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ splitAt :: forall a. Int -> [a] -> ([a], [a])
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ tail :: forall a. [a] -> [a]
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ take :: forall a. Int -> [a] -> [a]
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ takeWhile :: forall a. (a -> Bool) -> [a] -> [a]
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ unzip :: forall a b. [(a, b)] -> ([a], [b])
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ unzip3 :: forall a b c. [(a, b, c)] -> ([a], [b], [c])
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ zip3 :: forall a b c. [a] -> [b] -> [c] -> [(a, b, c)]
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ zipWith :: forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ zipWith3 :: forall a b c d.
+ (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ lex :: ReadS String
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Read’))
+ readParen :: forall a. Bool -> ReadS a -> ReadS a
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Read’))
+ (&&) :: Bool -> Bool -> Bool
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Classes’))
+ not :: Bool -> Bool
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Classes’))
+ (||) :: Bool -> Bool -> Bool
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Classes’))
+ seq :: forall a b. a -> b -> b
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.Prim’))
+ filter :: forall a. (a -> Bool) -> [a] -> [a]
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
+ zip :: forall a b. [a] -> [b] -> [(a, b)]
+ (imported from ‘Prelude’ at holes.hs:1:8-12
+ (and originally defined in ‘GHC.List’))
diff --git a/testsuite/tests/typecheck/should_compile/holes2.stderr b/testsuite/tests/typecheck/should_compile/holes2.stderr
index 37c206cf8d..4aafdfc876 100644
--- a/testsuite/tests/typecheck/should_compile/holes2.stderr
+++ b/testsuite/tests/typecheck/should_compile/holes2.stderr
@@ -22,11 +22,25 @@ holes2.hs:3:10: warning: [-Wtyped-holes (in -Wdefault)]
In an equation for ‘f’: f = show _
• Relevant bindings include f :: String (bound at holes2.hs:3:1)
Valid substitutions include
+ f :: String (defined at holes2.hs:3:1)
+ False :: Bool
+ (imported from ‘Prelude’ at holes2.hs:1:8-13
+ (and originally defined in ‘GHC.Types’))
+ True :: Bool
+ (imported from ‘Prelude’ at holes2.hs:1:8-13
+ (and originally defined in ‘GHC.Types’))
+ LT :: Ordering
+ (imported from ‘Prelude’ at holes2.hs:1:8-13
+ (and originally defined in ‘GHC.Types’))
+ EQ :: Ordering
+ (imported from ‘Prelude’ at holes2.hs:1:8-13
+ (and originally defined in ‘GHC.Types’))
+ GT :: Ordering
+ (imported from ‘Prelude’ at holes2.hs:1:8-13
+ (and originally defined in ‘GHC.Types’))
+ otherwise :: Bool
+ (imported from ‘Prelude’ at holes2.hs:1:8-13
+ (and originally defined in ‘GHC.Base’))
pi :: forall a. Floating a => a
(imported from ‘Prelude’ at holes2.hs:1:8-13
(and originally defined in ‘GHC.Float’))
- undefined :: forall (a :: TYPE r).
- GHC.Stack.Types.HasCallStack =>
- a
- (imported from ‘Prelude’ at holes2.hs:1:8-13
- (and originally defined in ‘GHC.Err’))
diff --git a/testsuite/tests/typecheck/should_compile/holes3.stderr b/testsuite/tests/typecheck/should_compile/holes3.stderr
index 76b6bbffe0..931c336664 100644
--- a/testsuite/tests/typecheck/should_compile/holes3.stderr
+++ b/testsuite/tests/typecheck/should_compile/holes3.stderr
@@ -2,11 +2,13 @@
holes3.hs:3:5: error:
• Found hole: _ :: t
Where: ‘t’ is a rigid type variable bound by
- the inferred type of f :: t at holes3.hs:3:1-5
+ the inferred type of f :: t
+ at holes3.hs:3:1-5
• In the expression: _
In an equation for ‘f’: f = _
• Relevant bindings include f :: t (bound at holes3.hs:3:1)
Valid substitutions include
+ f :: forall t. t (defined at holes3.hs:3:1)
undefined :: forall (a :: TYPE r).
GHC.Stack.Types.HasCallStack =>
a
@@ -44,6 +46,7 @@ holes3.hs:8:5: error:
• Relevant bindings include h :: [Char] (bound at holes3.hs:8:1)
Valid substitutions include
f :: forall t. t (defined at holes3.hs:3:1)
+ h :: [Char] (defined at holes3.hs:8:1)
mempty :: forall a. Monoid a => a
(imported from ‘Prelude’ at holes3.hs:1:8-13
(and originally defined in ‘GHC.Base’))
@@ -66,11 +69,450 @@ holes3.hs:11:15: error:
Valid substitutions include
f :: forall t. t (defined at holes3.hs:3:1)
g :: Int -> Char (defined at holes3.hs:6:1)
- toEnum :: forall a. Enum a => Int -> a
+ h :: [Char] (defined at holes3.hs:8:1)
+ z :: forall a. [a] -> [a] (defined at holes3.hs:11:1)
+ Left :: forall a b. a -> Either a b
(imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.Enum’))
+ (and originally defined in ‘Data.Either’))
+ Right :: forall a b. b -> Either a b
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘Data.Either’))
+ False :: Bool
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Types’))
+ True :: Bool
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Types’))
+ Nothing :: forall a. Maybe a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Base’))
+ Just :: forall a. a -> Maybe a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Base’))
+ LT :: Ordering
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Types’))
+ EQ :: Ordering
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Types’))
+ GT :: Ordering
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Types’))
+ (-) :: forall a. Num a => a -> a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Num’))
+ (.) :: forall b c a. (b -> c) -> (a -> b) -> a -> c
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Base’))
+ (++) :: forall a. [a] -> [a] -> [a]
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Base’))
+ const :: forall a b. a -> b -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Base’))
+ either :: forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘Data.Either’))
+ maybe :: forall b a. b -> (a -> b) -> Maybe a -> b
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘Data.Maybe’))
+ curry :: forall a b c. ((a, b) -> c) -> a -> b -> c
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘Data.Tuple’))
+ fst :: forall a b. (a, b) -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘Data.Tuple’))
+ snd :: forall a b. (a, b) -> b
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘Data.Tuple’))
+ uncurry :: forall a b c. (a -> b -> c) -> (a, b) -> c
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘Data.Tuple’))
+ ($) :: forall a (b :: TYPE r). (a -> b) -> a -> b
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Base’))
+ ($!) :: forall a b. (a -> b) -> a -> b
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Base’))
+ asTypeOf :: forall a. a -> a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Base’))
+ flip :: forall a b c. (a -> b -> c) -> b -> a -> c
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Base’))
+ id :: forall a. a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Base’))
+ map :: forall a b. (a -> b) -> [a] -> [b]
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Base’))
+ otherwise :: Bool
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Base’))
+ until :: forall a. (a -> Bool) -> (a -> a) -> a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Base’))
+ (**) :: forall a. Floating a => a -> a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ acos :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ acosh :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ asin :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ asinh :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ atan :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ atan2 :: forall a. RealFloat a => a -> a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ atanh :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ cos :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ cosh :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ decodeFloat :: forall a. RealFloat a => a -> (Integer, Int)
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ encodeFloat :: forall a. RealFloat a => Integer -> Int -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ exp :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ exponent :: forall a. RealFloat a => a -> Int
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ floatDigits :: forall a. RealFloat a => a -> Int
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ floatRadix :: forall a. RealFloat a => a -> Integer
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ floatRange :: forall a. RealFloat a => a -> (Int, Int)
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ isDenormalized :: forall a. RealFloat a => a -> Bool
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ isIEEE :: forall a. RealFloat a => a -> Bool
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ isInfinite :: forall a. RealFloat a => a -> Bool
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ isNaN :: forall a. RealFloat a => a -> Bool
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ isNegativeZero :: forall a. RealFloat a => a -> Bool
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ log :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ logBase :: forall a. Floating a => a -> a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ pi :: forall a. Floating a => a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ scaleFloat :: forall a. RealFloat a => Int -> a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ significand :: forall a. RealFloat a => a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ sin :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ sinh :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ sqrt :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ tan :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ tanh :: forall a. Floating a => a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Float’))
+ (*) :: forall a. Num a => a -> a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Num’))
+ (+) :: forall a. Num a => a -> a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Num’))
+ abs :: forall a. Num a => a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Num’))
+ fromInteger :: forall a. Num a => Integer -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Num’))
+ negate :: forall a. Num a => a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Num’))
+ signum :: forall a. Num a => a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Num’))
+ subtract :: forall a. Num a => a -> a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Num’))
+ (/) :: forall a. Fractional a => a -> a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
+ (^) :: forall a b. (Num a, Integral b) => a -> b -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
+ (^^) :: forall a b. (Fractional a, Integral b) => a -> b -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
+ ceiling :: forall a. RealFrac a => forall b. Integral b => a -> b
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
+ div :: forall a. Integral a => a -> a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
+ divMod :: forall a. Integral a => a -> a -> (a, a)
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
+ even :: forall a. Integral a => a -> Bool
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
+ floor :: forall a. RealFrac a => forall b. Integral b => a -> b
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
+ fromIntegral :: forall a b. (Integral a, Num b) => a -> b
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
+ fromRational :: forall a. Fractional a => Rational -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
+ gcd :: forall a. Integral a => a -> a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
+ lcm :: forall a. Integral a => a -> a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
+ mod :: forall a. Integral a => a -> a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
+ odd :: forall a. Integral a => a -> Bool
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
+ properFraction :: forall a.
+ RealFrac a =>
+ forall b. Integral b => a -> (b, a)
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
+ quot :: forall a. Integral a => a -> a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
+ quotRem :: forall a. Integral a => a -> a -> (a, a)
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
+ realToFrac :: forall a b. (Real a, Fractional b) => a -> b
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
+ recip :: forall a. Fractional a => a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
+ rem :: forall a. Integral a => a -> a -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
+ round :: forall a. RealFrac a => forall b. Integral b => a -> b
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
+ toInteger :: forall a. Integral a => a -> Integer
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
+ toRational :: forall a. Real a => a -> Rational
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
+ truncate :: forall a. RealFrac a => forall b. Integral b => a -> b
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
+ showChar :: Char -> ShowS
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Show’))
+ showParen :: Bool -> ShowS -> ShowS
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Show’))
+ showString :: String -> ShowS
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Show’))
+ appendFile :: FilePath -> String -> IO ()
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘System.IO’))
+ getChar :: IO Char
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘System.IO’))
+ getContents :: IO String
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘System.IO’))
+ getLine :: IO String
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘System.IO’))
+ interact :: (String -> String) -> IO ()
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘System.IO’))
+ putChar :: Char -> IO ()
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘System.IO’))
+ putStr :: String -> IO ()
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘System.IO’))
+ putStrLn :: String -> IO ()
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘System.IO’))
+ readFile :: FilePath -> IO String
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘System.IO’))
+ writeFile :: FilePath -> String -> IO ()
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘System.IO’))
+ lines :: String -> [String]
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘base-4.11.0.0:Data.OldList’))
+ unlines :: [String] -> String
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘base-4.11.0.0:Data.OldList’))
+ unwords :: [String] -> String
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘base-4.11.0.0:Data.OldList’))
+ words :: String -> [String]
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘base-4.11.0.0:Data.OldList’))
+ error :: forall (a :: TYPE r).
+ GHC.Stack.Types.HasCallStack =>
+ [Char] -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Err’))
+ errorWithoutStackTrace :: forall (a :: TYPE r). [Char] -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Err’))
undefined :: forall (a :: TYPE r).
GHC.Stack.Types.HasCallStack =>
a
(imported from ‘Prelude’ at holes3.hs:1:8-13
(and originally defined in ‘GHC.Err’))
+ ioError :: forall a. IOError -> IO a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.IO.Exception’))
+ userError :: String -> IOError
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.IO.Exception’))
+ (!!) :: forall a. [a] -> Int -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ break :: forall a. (a -> Bool) -> [a] -> ([a], [a])
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ cycle :: forall a. [a] -> [a]
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ drop :: forall a. Int -> [a] -> [a]
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ dropWhile :: forall a. (a -> Bool) -> [a] -> [a]
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ head :: forall a. [a] -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ init :: forall a. [a] -> [a]
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ iterate :: forall a. (a -> a) -> a -> [a]
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ last :: forall a. [a] -> a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ repeat :: forall a. a -> [a]
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ replicate :: forall a. Int -> a -> [a]
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ reverse :: forall a. [a] -> [a]
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ scanl :: forall b a. (b -> a -> b) -> b -> [a] -> [b]
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ scanl1 :: forall a. (a -> a -> a) -> [a] -> [a]
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ scanr :: forall a b. (a -> b -> b) -> b -> [a] -> [b]
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ scanr1 :: forall a. (a -> a -> a) -> [a] -> [a]
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ span :: forall a. (a -> Bool) -> [a] -> ([a], [a])
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ splitAt :: forall a. Int -> [a] -> ([a], [a])
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ tail :: forall a. [a] -> [a]
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ take :: forall a. Int -> [a] -> [a]
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ takeWhile :: forall a. (a -> Bool) -> [a] -> [a]
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ unzip :: forall a b. [(a, b)] -> ([a], [b])
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ unzip3 :: forall a b c. [(a, b, c)] -> ([a], [b], [c])
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ zip3 :: forall a b c. [a] -> [b] -> [c] -> [(a, b, c)]
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ zipWith :: forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ zipWith3 :: forall a b c d.
+ (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ lex :: ReadS String
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Read’))
+ readParen :: forall a. Bool -> ReadS a -> ReadS a
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Read’))
+ (&&) :: Bool -> Bool -> Bool
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Classes’))
+ not :: Bool -> Bool
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Classes’))
+ (||) :: Bool -> Bool -> Bool
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Classes’))
+ seq :: forall a b. a -> b -> b
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.Prim’))
+ filter :: forall a. (a -> Bool) -> [a] -> [a]
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
+ zip :: forall a b. [a] -> [b] -> [(a, b)]
+ (imported from ‘Prelude’ at holes3.hs:1:8-13
+ (and originally defined in ‘GHC.List’))
diff --git a/testsuite/tests/typecheck/should_compile/valid_substitutions.hs b/testsuite/tests/typecheck/should_compile/valid_substitutions.hs
index bae315b8e8..646bc0ab57 100644
--- a/testsuite/tests/typecheck/should_compile/valid_substitutions.hs
+++ b/testsuite/tests/typecheck/should_compile/valid_substitutions.hs
@@ -1,13 +1,21 @@
module Foo where
-import Prelude hiding (putStr)
-import qualified System.IO
+import Prelude hiding (putStr, putStrLn)
+import qualified System.IO (putStr, putStrLn)
import Data.Maybe
import qualified ValidSubs
ps :: String -> IO ()
ps = putStrLn
+a :: Int -> IO Int
+a _ = return 1
+b :: Int -> IO Int
+b _ = return 2
+c :: Int -> IO Int
+c _ = do { x <- a 0
+ ; y <- _ x
+ ; return y }
test :: [Maybe a] -> [a]
test = _
@@ -15,5 +23,15 @@ test = _
test2 :: Integer -> ValidSubs.Moo
test2 = _
+k :: Maybe Integer
+k = _ 2
+
+f :: String
+f = show _
+
+
+h :: String
+h = show (_ (_ :: Bool))
+
main :: IO ()
main = _ "hello, world"
diff --git a/testsuite/tests/typecheck/should_compile/valid_substitutions.stderr b/testsuite/tests/typecheck/should_compile/valid_substitutions.stderr
index a0de0e2f13..1d7c911455 100644
--- a/testsuite/tests/typecheck/should_compile/valid_substitutions.stderr
+++ b/testsuite/tests/typecheck/should_compile/valid_substitutions.stderr
@@ -1,75 +1,272 @@
[1 of 2] Compiling ValidSubs ( ValidSubs.hs, ValidSubs.o )
[2 of 2] Compiling Foo ( valid_substitutions.hs, valid_substitutions.o )
-valid_substitutions.hs:13:8: warning: [-Wtyped-holes (in -Wdefault)]
+valid_substitutions.hs:9:6: warning: [-Wdeferred-out-of-scope-variables (in -Wdefault)]
+ • Variable not in scope: putStrLn :: String -> IO ()
+ • Perhaps you meant one of these:
+ ‘System.IO.putStrLn’ (imported from System.IO),
+ ‘System.IO.putStr’ (imported from System.IO)
+ Perhaps you want to remove ‘putStrLn’ from the explicit hiding list
+ in the import of ‘Prelude’ (valid_substitutions.hs:3:1-40).
+
+valid_substitutions.hs:17:17: warning: [-Wtyped-holes (in -Wdefault)]
+ • Found hole: _ :: Int -> IO Int
+ • In the expression: _
+ In a stmt of a 'do' block: y <- _ x
+ In the expression:
+ do x <- a 0
+ y <- _ x
+ return y
+ • Relevant bindings include
+ x :: Int (bound at valid_substitutions.hs:16:12)
+ c :: Int -> IO Int (bound at valid_substitutions.hs:16:1)
+ Valid substitutions include
+ a :: Int -> IO Int (defined at valid_substitutions.hs:12:1)
+ b :: Int -> IO Int (defined at valid_substitutions.hs:14:1)
+ c :: Int -> IO Int (defined at valid_substitutions.hs:16:1)
+ pure :: forall (f :: * -> *). Applicative f => forall a. a -> f a
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.Base’))
+ return :: forall (m :: * -> *). Monad m => forall a. a -> m a
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.Base’))
+ undefined :: forall (a :: TYPE r).
+ GHC.Stack.Types.HasCallStack =>
+ a
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.Err’))
+
+valid_substitutions.hs:21:8: warning: [-Wtyped-holes (in -Wdefault)]
• Found hole: _ :: [Maybe a] -> [a]
Where: ‘a’ is a rigid type variable bound by
the type signature for:
test :: forall a. [Maybe a] -> [a]
- at valid_substitutions.hs:12:1-24
+ at valid_substitutions.hs:20:1-24
• In the expression: _
In an equation for ‘test’: test = _
• Relevant bindings include
- test :: [Maybe a] -> [a] (bound at valid_substitutions.hs:13:1)
+ test :: [Maybe a] -> [a] (bound at valid_substitutions.hs:21:1)
Valid substitutions include
+ test :: forall a. [Maybe a] -> [a]
+ (defined at valid_substitutions.hs:21:1)
mempty :: forall a. Monoid a => a
- (imported from ‘Prelude’ at valid_substitutions.hs:3:1-30
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
(and originally defined in ‘GHC.Base’))
undefined :: forall (a :: TYPE r).
GHC.Stack.Types.HasCallStack =>
a
- (imported from ‘Prelude’ at valid_substitutions.hs:3:1-30
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
(and originally defined in ‘GHC.Err’))
catMaybes :: forall a. [Maybe a] -> [a]
(imported from ‘Data.Maybe’ at valid_substitutions.hs:5:1-17)
-valid_substitutions.hs:16:9: warning: [-Wtyped-holes (in -Wdefault)]
+valid_substitutions.hs:24:9: warning: [-Wtyped-holes (in -Wdefault)]
• Found hole: _ :: Integer -> ValidSubs.Moo
• In the expression: _
In an equation for ‘test2’: test2 = _
• Relevant bindings include
test2 :: Integer -> ValidSubs.Moo
- (bound at valid_substitutions.hs:16:1)
+ (bound at valid_substitutions.hs:24:1)
Valid substitutions include
+ test2 :: Integer -> ValidSubs.Moo
+ (defined at valid_substitutions.hs:24:1)
+ ValidSubs.Moo :: Integer -> ValidSubs.Moo
+ (imported qualified from ‘ValidSubs’ at valid_substitutions.hs:6:1-26
+ (and originally defined at ValidSubs.hs:4:12-22))
+ undefined :: forall (a :: TYPE r).
+ GHC.Stack.Types.HasCallStack =>
+ a
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.Err’))
+
+valid_substitutions.hs:27:5: warning: [-Wtyped-holes (in -Wdefault)]
+ • Found hole: _ :: Integer -> Maybe Integer
+ • In the expression: _
+ In the expression: _ 2
+ In an equation for ‘k’: k = _ 2
+ • Relevant bindings include
+ k :: Maybe Integer (bound at valid_substitutions.hs:27:1)
+ Valid substitutions include
+ Just :: forall a. a -> Maybe a
+ (imported from ‘Data.Maybe’ at valid_substitutions.hs:5:1-17
+ (and originally defined in ‘GHC.Base’))
+ pure :: forall (f :: * -> *). Applicative f => forall a. a -> f a
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.Base’))
+ return :: forall (m :: * -> *). Monad m => forall a. a -> m a
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.Base’))
+ undefined :: forall (a :: TYPE r).
+ GHC.Stack.Types.HasCallStack =>
+ a
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.Err’))
+
+valid_substitutions.hs:30:5: warning: [-Wdeferred-type-errors (in -Wdefault)]
+ • Ambiguous type variable ‘a1’ arising from a use of ‘show’
+ prevents the constraint ‘(Show a1)’ from being solved.
+ Probable fix: use a type annotation to specify what ‘a1’ should be.
+ These potential instances exist:
+ instance (Show a, Show b) => Show (Either a b)
+ -- Defined in ‘Data.Either’
+ instance Show Ordering -- Defined in ‘GHC.Show’
+ instance Show Integer -- Defined in ‘GHC.Show’
+ ...plus 23 others
+ ...plus 67 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 _
+
+valid_substitutions.hs:30:10: warning: [-Wtyped-holes (in -Wdefault)]
+ • Found hole: _ :: a1
+ Where: ‘a1’ is an ambiguous type variable
+ • In the first argument of ‘show’, namely ‘_’
+ In the expression: show _
+ In an equation for ‘f’: f = show _
+ • Relevant bindings include
+ f :: String (bound at valid_substitutions.hs:30:1)
+ Valid substitutions include
+ h :: String (defined at valid_substitutions.hs:34:1)
+ f :: String (defined at valid_substitutions.hs:30:1)
+ k :: Maybe Integer (defined at valid_substitutions.hs:27:1)
+ False :: Bool
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.Types’))
+ True :: Bool
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.Types’))
+ LT :: Ordering
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.Types’))
+ EQ :: Ordering
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.Types’))
+ GT :: Ordering
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.Types’))
+ otherwise :: Bool
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.Base’))
+ pi :: forall a. Floating a => a
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.Float’))
+
+valid_substitutions.hs:34: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:
+ instance (Show a, Show b) => Show (Either a b)
+ -- Defined in ‘Data.Either’
+ instance Show Ordering -- Defined in ‘GHC.Show’
+ instance Show Integer -- Defined in ‘GHC.Show’
+ ...plus 23 others
+ ...plus 67 instances involving out-of-scope types
+ (use -fprint-potential-instances to see them all)
+ • In the expression: show (_ (_ :: Bool))
+ In an equation for ‘h’: h = show (_ (_ :: Bool))
+
+valid_substitutions.hs:34:11: warning: [-Wtyped-holes (in -Wdefault)]
+ • Found hole: _ :: Bool -> a0
+ Where: ‘a0’ is an ambiguous type variable
+ • In the expression: _
+ In the first argument of ‘show’, namely ‘(_ (_ :: Bool))’
+ In the expression: show (_ (_ :: Bool))
+ • Relevant bindings include
+ h :: String (bound at valid_substitutions.hs:34:1)
+ Valid substitutions include
+ Just :: forall a. a -> Maybe a
+ (imported from ‘Data.Maybe’ at valid_substitutions.hs:5:1-17
+ (and originally defined in ‘GHC.Base’))
+ id :: forall a. a -> a
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.Base’))
+ enumFrom :: forall a. Enum a => a -> [a]
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.Enum’))
+ fromEnum :: forall a. Enum a => a -> Int
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.Enum’))
+ pred :: forall a. Enum a => a -> a
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.Enum’))
+ succ :: forall a. Enum a => a -> a
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.Enum’))
+ show :: forall a. Show a => a -> String
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.Show’))
+ repeat :: forall a. a -> [a]
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.List’))
+ not :: Bool -> Bool
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.Classes’))
+
+valid_substitutions.hs:34:14: warning: [-Wtyped-holes (in -Wdefault)]
+ • Found hole: _ :: Bool
+ • In the first argument of ‘_’, namely ‘(_ :: Bool)’
+ In the first argument of ‘show’, namely ‘(_ (_ :: Bool))’
+ In the expression: show (_ (_ :: Bool))
+ • Relevant bindings include
+ h :: String (bound at valid_substitutions.hs:34:1)
+ Valid substitutions include
+ False :: Bool
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.Types’))
+ True :: Bool
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.Types’))
+ otherwise :: Bool
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.Base’))
+ maxBound :: forall a. Bounded a => a
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.Enum’))
+ minBound :: forall a. Bounded a => a
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘GHC.Enum’))
undefined :: forall (a :: TYPE r).
GHC.Stack.Types.HasCallStack =>
a
- (imported from ‘Prelude’ at valid_substitutions.hs:3:1-30
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
(and originally defined in ‘GHC.Err’))
-valid_substitutions.hs:19:8: warning: [-Wtyped-holes (in -Wdefault)]
+valid_substitutions.hs:37:8: warning: [-Wtyped-holes (in -Wdefault)]
• Found hole: _ :: [Char] -> IO ()
• In the expression: _
In the expression: _ "hello, world"
In an equation for ‘main’: main = _ "hello, world"
• Relevant bindings include
- main :: IO () (bound at valid_substitutions.hs:19:1)
+ main :: IO () (bound at valid_substitutions.hs:37:1)
Valid substitutions include
ps :: String -> IO () (defined at valid_substitutions.hs:9:1)
System.IO.putStr :: String -> IO ()
- (imported qualified from ‘System.IO’ at valid_substitutions.hs:4:1-26)
+ (imported qualified from ‘System.IO’ at valid_substitutions.hs:4:29-34)
+ System.IO.putStrLn :: String -> IO ()
+ (imported qualified from ‘System.IO’ at valid_substitutions.hs:4:37-44)
fail :: forall (m :: * -> *). Monad m => forall a. String -> m a
- (imported from ‘Prelude’ at valid_substitutions.hs:3:1-30
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
(and originally defined in ‘GHC.Base’))
mempty :: forall a. Monoid a => a
- (imported from ‘Prelude’ at valid_substitutions.hs:3:1-30
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
(and originally defined in ‘GHC.Base’))
print :: forall a. Show a => a -> IO ()
- (imported qualified from ‘System.IO’ at valid_substitutions.hs:4:1-26)
- putStrLn :: String -> IO ()
- (imported qualified from ‘System.IO’ at valid_substitutions.hs:4:1-26)
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘System.IO’))
readIO :: forall a. Read a => String -> IO a
- (imported qualified from ‘System.IO’ at valid_substitutions.hs:4:1-26)
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
+ (and originally defined in ‘System.IO’))
error :: forall (a :: TYPE r).
GHC.Stack.Types.HasCallStack =>
[Char] -> a
- (imported from ‘Prelude’ at valid_substitutions.hs:3:1-30
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
(and originally defined in ‘GHC.Err’))
errorWithoutStackTrace :: forall (a :: TYPE r). [Char] -> a
- (imported from ‘Prelude’ at valid_substitutions.hs:3:1-30
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
(and originally defined in ‘GHC.Err’))
undefined :: forall (a :: TYPE r).
GHC.Stack.Types.HasCallStack =>
a
- (imported from ‘Prelude’ at valid_substitutions.hs:3:1-30
+ (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
(and originally defined in ‘GHC.Err’))
diff --git a/testsuite/tests/typecheck/should_compile/valid_substitutions_interactions.hs b/testsuite/tests/typecheck/should_compile/valid_substitutions_interactions.hs
new file mode 100644
index 0000000000..a2186e73a3
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/valid_substitutions_interactions.hs
@@ -0,0 +1,15 @@
+{-# LANGUAGE GADTs #-}
+{-# LANGUAGE TypeInType #-}
+{-# LANGUAGE TypeFamilies #-}
+
+module ValidSubsInteractions where
+
+import Data.Kind
+
+
+data SBool :: Bool -> Type where
+ SFalse :: SBool 'False
+ STrue :: SBool 'True
+
+f :: SBool 'True
+f = _
diff --git a/testsuite/tests/typecheck/should_compile/valid_substitutions_interactions.stderr b/testsuite/tests/typecheck/should_compile/valid_substitutions_interactions.stderr
new file mode 100644
index 0000000000..bb50a657f6
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/valid_substitutions_interactions.stderr
@@ -0,0 +1,18 @@
+
+valid_substitutions_interactions.hs:15:5: warning: [-Wtyped-holes (in -Wdefault)]
+ • Found hole: _ :: SBool 'True
+ • In the expression: _
+ In an equation for ‘f’: f = _
+ • Relevant bindings include
+ f :: SBool 'True
+ (bound at valid_substitutions_interactions.hs:15:1)
+ Valid substitutions include
+ STrue :: SBool 'True
+ (defined at valid_substitutions_interactions.hs:12:3)
+ f :: SBool 'True
+ (defined at valid_substitutions_interactions.hs:15:1)
+ undefined :: forall (a :: TYPE r).
+ GHC.Stack.Types.HasCallStack =>
+ a
+ (imported from ‘Prelude’ at valid_substitutions_interactions.hs:5:8-28
+ (and originally defined in ‘GHC.Err’))
diff --git a/testsuite/tests/typecheck/should_fail/T9497d.stderr b/testsuite/tests/typecheck/should_fail/T9497d.stderr
index a7b7bfb89a..294e92e505 100644
--- a/testsuite/tests/typecheck/should_fail/T9497d.stderr
+++ b/testsuite/tests/typecheck/should_fail/T9497d.stderr
@@ -6,6 +6,7 @@ T9497d.hs:2:8: error:
In an equation for ‘main’: main = _main
• Relevant bindings include main :: IO () (bound at T9497d.hs:2:1)
Valid substitutions include
+ main :: IO () (defined at T9497d.hs:2:1)
mempty :: forall a. Monoid a => a
(imported from ‘Prelude’ at T9497d.hs:1:1
(and originally defined in ‘GHC.Base’))
diff --git a/testsuite/tests/typecheck/should_run/T9497a-run.stderr b/testsuite/tests/typecheck/should_run/T9497a-run.stderr
index ad3a9279ff..4fc42e5122 100644
--- a/testsuite/tests/typecheck/should_run/T9497a-run.stderr
+++ b/testsuite/tests/typecheck/should_run/T9497a-run.stderr
@@ -6,6 +6,7 @@ T9497a-run: T9497a-run.hs:2:8: error:
• Relevant bindings include
main :: IO () (bound at T9497a-run.hs:2:1)
Valid substitutions include
+ main :: IO () (defined at T9497a-run.hs:2:1)
mempty :: forall a. Monoid a => a
(imported from ‘Prelude’ at T9497a-run.hs:1:1
(and originally defined in ‘GHC.Base’))
diff --git a/testsuite/tests/typecheck/should_run/T9497b-run.stderr b/testsuite/tests/typecheck/should_run/T9497b-run.stderr
index 8836ee262e..2141035232 100644
--- a/testsuite/tests/typecheck/should_run/T9497b-run.stderr
+++ b/testsuite/tests/typecheck/should_run/T9497b-run.stderr
@@ -6,6 +6,7 @@ T9497b-run: T9497b-run.hs:2:8: error:
• Relevant bindings include
main :: IO () (bound at T9497b-run.hs:2:1)
Valid substitutions include
+ main :: IO () (defined at T9497b-run.hs:2:1)
mempty :: forall a. Monoid a => a
(imported from ‘Prelude’ at T9497b-run.hs:1:1
(and originally defined in ‘GHC.Base’))
diff --git a/testsuite/tests/typecheck/should_run/T9497c-run.stderr b/testsuite/tests/typecheck/should_run/T9497c-run.stderr
index 829abf59e9..dd2426ec84 100644
--- a/testsuite/tests/typecheck/should_run/T9497c-run.stderr
+++ b/testsuite/tests/typecheck/should_run/T9497c-run.stderr
@@ -6,6 +6,7 @@ T9497c-run: T9497c-run.hs:2:8: error:
• Relevant bindings include
main :: IO () (bound at T9497c-run.hs:2:1)
Valid substitutions include
+ main :: IO () (defined at T9497c-run.hs:2:1)
mempty :: forall a. Monoid a => a
(imported from ‘Prelude’ at T9497c-run.hs:1:1
(and originally defined in ‘GHC.Base’))