summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthías Páll Gissurarson <mpg@mpg.is>2018-05-27 11:50:49 -0400
committerBen Gamari <ben@smart-cactus.org>2018-05-30 15:21:34 -0400
commite0b44e2eccd4053852b6c4c3de75a714301ec080 (patch)
tree0095bdd908921a8fa17a30275527d312f2dca8b9
parentb876c1bb5c8ccd73a203c0f94bac3cbb9c7e2d65 (diff)
downloadhaskell-e0b44e2eccd4053852b6c4c3de75a714301ec080.tar.gz
Improved Valid Hole Fits
I've changed the name from `Valid substitutions` to `Valid hole fits`, since "substitution" already has a well defined meaning within the theory. As part of this change, the flags and output is reanamed, with substitution turning into hole-fit in most cases. "hole fit" was already used internally in the code, it's clear and shouldn't cause any confusion. In this update, I've also reworked how we manage side-effects in the hole we are considering. This allows us to consider local bindings such as where clauses and arguments to functions, suggesting e.g. `a` for `head (x:xs) where head :: [a] -> a`. It also allows us to find suggestions such as `maximum` for holes of type `Ord a => a -> [a]`, and `max` when looking for a match for the hole in `g = foldl1 _`, where `g :: Ord a => [a] -> a`. We also show much improved output for refinement hole fits, and fixes #14990. We now show the correct type of the function, but we also now show what the arguments to the function should be e.g. `foldl1 (_ :: Integer -> Integer -> Integer)` when looking for `[Integer] -> Integer`. I've moved the bulk of the code from `TcErrors.hs` to a new file, `TcHoleErrors.hs`, since it was getting too big to not live on it's own. This addresses the considerations raised in #14969, and takes proper care to set the `tcLevel` of the variables to the right level before passing it to the simplifier. We now also zonk the suggestions properly, which improves the output of the refinement hole fits considerably. This also filters out suggestions from the `GHC.Err` module, since even though `error` and `undefined` are indeed valid hole fits, they are "trivial", and almost never useful to the user. We now find the hole fits using the proper manner, namely by solving nested implications. This entails that the givens are passed along using the implications the hole was nested in, which in turn should mean that there will be fewer weird bugs in the typed holes. I've also added a new sorting method (as suggested by SPJ) and sort by the size of the types needed to turn the hole fits into the type of the hole. This gives a reasonable approximation to relevance, and is much faster than the subsumption check. I've also added a flag to toggle whether to use this new sorting algorithm (as is done by default) or the subsumption algorithm. This fixes #14969 I've also added documentation for these new flags and update the documentation according to the new output. Reviewers: bgamari, goldfire Reviewed By: bgamari Subscribers: simonpj, rwbarton, thomie, carter GHC Trac Issues: #14969, #14990, #10946 Differential Revision: https://phabricator.haskell.org/D4444
-rw-r--r--compiler/ghc.cabal.in1
-rw-r--r--compiler/main/DynFlags.hs120
-rw-r--r--compiler/typecheck/TcErrors.hs489
-rw-r--r--compiler/typecheck/TcHoleErrors.hs917
-rw-r--r--compiler/typecheck/TcHoleErrors.hs-boot12
-rw-r--r--compiler/typecheck/TcMType.hs9
-rw-r--r--compiler/typecheck/TcRnTypes.hs28
-rw-r--r--compiler/typecheck/TcSimplify.hs37
-rw-r--r--compiler/typecheck/TcSimplify.hs-boot11
-rw-r--r--docs/users_guide/8.6.1-notes.rst4
-rw-r--r--docs/users_guide/glasgow_exts.rst465
-rw-r--r--testsuite/tests/gadt/T12468.stderr8
-rw-r--r--testsuite/tests/ghci/scripts/T10248.stderr4
-rw-r--r--testsuite/tests/ghci/scripts/T10249.stderr3
-rw-r--r--testsuite/tests/ghci/scripts/T8353.stderr45
-rw-r--r--testsuite/tests/module/mod71.stderr5
-rw-r--r--testsuite/tests/partial-sigs/should_compile/T12531.stderr5
-rw-r--r--testsuite/tests/th/T10267.stderr58
-rw-r--r--testsuite/tests/th/all.T2
-rw-r--r--testsuite/tests/typecheck/should_compile/T13050.stderr225
-rw-r--r--testsuite/tests/typecheck/should_compile/T14273.stderr27
-rw-r--r--testsuite/tests/typecheck/should_compile/T14590.stderr304
-rw-r--r--testsuite/tests/typecheck/should_compile/T9497a.stderr9
-rw-r--r--testsuite/tests/typecheck/should_compile/ValidHoleFits.hs4
-rw-r--r--testsuite/tests/typecheck/should_compile/ValidSubs.hs4
-rw-r--r--testsuite/tests/typecheck/should_compile/abstract_refinement_hole_fits.hs (renamed from testsuite/tests/typecheck/should_compile/abstract_refinement_substitutions.hs)0
-rw-r--r--testsuite/tests/typecheck/should_compile/abstract_refinement_hole_fits.stderr277
-rw-r--r--testsuite/tests/typecheck/should_compile/abstract_refinement_substitutions.stderr410
-rw-r--r--testsuite/tests/typecheck/should_compile/all.T31
-rw-r--r--testsuite/tests/typecheck/should_compile/constraint_hole_fits.hs4
-rw-r--r--testsuite/tests/typecheck/should_compile/constraint_hole_fits.stderr65
-rw-r--r--testsuite/tests/typecheck/should_compile/free_monad_hole_fits.hs25
-rw-r--r--testsuite/tests/typecheck/should_compile/free_monad_hole_fits.stderr81
-rw-r--r--testsuite/tests/typecheck/should_compile/hole_constraints.stderr44
-rw-r--r--testsuite/tests/typecheck/should_compile/hole_constraints_nested.stderr9
-rw-r--r--testsuite/tests/typecheck/should_compile/holes.stderr574
-rw-r--r--testsuite/tests/typecheck/should_compile/holes2.stderr24
-rw-r--r--testsuite/tests/typecheck/should_compile/holes3.stderr574
-rwxr-xr-xtestsuite/tests/typecheck/should_compile/local_hole_fits.hs11
-rw-r--r--testsuite/tests/typecheck/should_compile/local_hole_fits.stderr28
-rw-r--r--testsuite/tests/typecheck/should_compile/refinement_hole_fits.hs (renamed from testsuite/tests/typecheck/should_compile/refinement_substitutions.hs)0
-rw-r--r--testsuite/tests/typecheck/should_compile/refinement_hole_fits.stderr236
-rw-r--r--testsuite/tests/typecheck/should_compile/refinement_substitutions.stderr330
-rwxr-xr-xtestsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.hs5
-rw-r--r--testsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.stderr39
-rw-r--r--testsuite/tests/typecheck/should_compile/type_in_type_hole_fits.hs88
-rw-r--r--testsuite/tests/typecheck/should_compile/type_in_type_hole_fits.stderr78
-rw-r--r--testsuite/tests/typecheck/should_compile/valid_hole_fits.hs (renamed from testsuite/tests/typecheck/should_compile/valid_substitutions.hs)4
-rw-r--r--testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr255
-rw-r--r--testsuite/tests/typecheck/should_compile/valid_hole_fits_interactions.hs (renamed from testsuite/tests/typecheck/should_compile/valid_substitutions_interactions.hs)0
-rw-r--r--testsuite/tests/typecheck/should_compile/valid_hole_fits_interactions.stderr11
-rw-r--r--testsuite/tests/typecheck/should_compile/valid_substitutions.stderr258
-rw-r--r--testsuite/tests/typecheck/should_compile/valid_substitutions_interactions.stderr16
-rw-r--r--testsuite/tests/typecheck/should_fail/T12177.stderr8
-rw-r--r--testsuite/tests/typecheck/should_fail/T14884.stderr17
-rw-r--r--testsuite/tests/typecheck/should_fail/T9497d.stderr9
-rw-r--r--testsuite/tests/typecheck/should_run/T9497a-run.stderr9
-rw-r--r--testsuite/tests/typecheck/should_run/T9497b-run.stderr9
-rw-r--r--testsuite/tests/typecheck/should_run/T9497c-run.stderr9
59 files changed, 3286 insertions, 3048 deletions
diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in
index 9b96fc5a83..267e03b084 100644
--- a/compiler/ghc.cabal.in
+++ b/compiler/ghc.cabal.in
@@ -468,6 +468,7 @@ Library
TcRnTypes
TcRules
TcSimplify
+ TcHoleErrors
TcErrors
TcTyClsDecls
TcTyDecls
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index a20aac5689..2a96fd0966 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -566,10 +566,21 @@ data GeneralFlag
| Opt_PprCaseAsLet
| Opt_PprShowTicks
| Opt_ShowHoleConstraints
- | Opt_NoShowValidSubstitutions
- | Opt_UnclutterValidSubstitutions
- | Opt_NoSortValidSubstitutions
- | Opt_AbstractRefSubstitutions
+ -- Options relating to the display of valid hole fits
+ -- when generating an error message for a typed hole
+ -- See Note [Valid hole fits include] in TcHoleErrors.hs
+ | Opt_ShowValidHoleFits
+ | Opt_SortValidHoleFits
+ | Opt_SortBySizeHoleFits
+ | Opt_SortBySubsumHoleFits
+ | Opt_AbstractRefHoleFits
+ | Opt_UnclutterValidHoleFits
+ | Opt_ShowTypeAppOfHoleFits
+ | Opt_ShowTypeAppVarsOfHoleFits
+ | Opt_ShowTypeOfHoleFits
+ | Opt_ShowProvOfHoleFits
+ | Opt_ShowMatchesOfHoleFits
+
| Opt_ShowLoadedModules
| Opt_HexWordLiterals -- See Note [Print Hexadecimal Literals]
@@ -850,14 +861,14 @@ data DynFlags = DynFlags {
maxRelevantBinds :: Maybe Int, -- ^ Maximum number of bindings from the type envt
-- to show in type error messages
- maxValidSubstitutions :: Maybe Int, -- ^ Maximum number of substitutions to
- -- show in typed hole error messages
- maxRefSubstitutions :: Maybe Int, -- ^ Maximum number of refinement
- -- substitutions to show in typed hole
+ maxValidHoleFits :: Maybe Int, -- ^ Maximum number of hole fits to show
+ -- in typed hole error messages
+ maxRefHoleFits :: Maybe Int, -- ^ Maximum number of refinement hole
+ -- fits to show in typed hole error
+ -- messages
+ refLevelHoleFits :: Maybe Int, -- ^ Maximum level of refinement for
+ -- refinement hole fits in typed hole
-- error messages
- refLevelSubstitutions :: Maybe Int, -- ^ Maximum level of refinement for
- -- refinement substitutions in typed
- -- typed hole error messages
maxUncoveredPatterns :: Int, -- ^ Maximum number of unmatched patterns to show
-- in non-exhaustiveness warnings
simplTickFactor :: Int, -- ^ Multiplier for simplifier ticks
@@ -1741,9 +1752,9 @@ defaultDynFlags mySettings (myLlvmTargets, myLlvmPasses) =
ruleCheck = Nothing,
inlineCheck = Nothing,
maxRelevantBinds = Just 6,
- maxValidSubstitutions = Just 6,
- maxRefSubstitutions = Just 6,
- refLevelSubstitutions = Nothing,
+ maxValidHoleFits = Just 6,
+ maxRefHoleFits = Just 6,
+ refLevelHoleFits = Nothing,
maxUncoveredPatterns = 4,
simplTickFactor = 100,
specConstrThreshold = Just 2000,
@@ -3333,18 +3344,20 @@ dynamic_flags_deps = [
(intSuffix (\n d -> d { maxRelevantBinds = Just n }))
, make_ord_flag defFlag "fno-max-relevant-binds"
(noArg (\d -> d { maxRelevantBinds = Nothing }))
- , make_ord_flag defFlag "fmax-valid-substitutions"
- (intSuffix (\n d -> d { maxValidSubstitutions = Just n }))
- , make_ord_flag defFlag "fno-max-valid-substitutions"
- (noArg (\d -> d { maxValidSubstitutions = Nothing }))
- , make_ord_flag defFlag "fmax-refinement-substitutions"
- (intSuffix (\n d -> d { maxRefSubstitutions = Just n }))
- , make_ord_flag defFlag "fno-max-refinement-substitutions"
- (noArg (\d -> d { maxRefSubstitutions = Nothing }))
- , make_ord_flag defFlag "frefinement-level-substitutions"
- (intSuffix (\n d -> d { refLevelSubstitutions = Just n }))
- , make_ord_flag defFlag "fno-refinement-level-substitutions"
- (noArg (\d -> d { refLevelSubstitutions = Nothing }))
+
+ , make_ord_flag defFlag "fmax-valid-hole-fits"
+ (intSuffix (\n d -> d { maxValidHoleFits = Just n }))
+ , make_ord_flag defFlag "fno-max-valid-hole-fits"
+ (noArg (\d -> d { maxValidHoleFits = Nothing }))
+ , make_ord_flag defFlag "fmax-refinement-hole-fits"
+ (intSuffix (\n d -> d { maxRefHoleFits = Just n }))
+ , make_ord_flag defFlag "fno-max-refinement-hole-fits"
+ (noArg (\d -> d { maxRefHoleFits = Nothing }))
+ , make_ord_flag defFlag "frefinement-level-hole-fits"
+ (intSuffix (\n d -> d { refLevelHoleFits = Just n }))
+ , make_ord_flag defFlag "fno-refinement-level-hole-fits"
+ (noArg (\d -> d { refLevelHoleFits = Nothing }))
+
, make_ord_flag defFlag "fmax-uncovered-patterns"
(intSuffix (\n d -> d { maxUncoveredPatterns = n }))
, make_ord_flag defFlag "fsimplifier-phases"
@@ -3964,14 +3977,34 @@ fFlagsDeps = [
flagSpec "alignment-sanitisation" Opt_AlignmentSanitisation,
flagSpec "show-warning-groups" Opt_ShowWarnGroups,
flagSpec "hide-source-paths" Opt_HideSourcePaths,
- flagSpec "show-hole-constraints" Opt_ShowHoleConstraints,
- flagSpec "no-show-valid-substitutions" Opt_NoShowValidSubstitutions,
- flagSpec "no-sort-valid-substitutions" Opt_NoSortValidSubstitutions,
- flagSpec "abstract-refinement-substitutions" Opt_AbstractRefSubstitutions,
- flagSpec "unclutter-valid-substitutions" Opt_UnclutterValidSubstitutions,
flagSpec "show-loaded-modules" Opt_ShowLoadedModules,
flagSpec "whole-archive-hs-libs" Opt_WholeArchiveHsLibs
]
+ ++ fHoleFlags
+
+-- | These @-f\<blah\>@ flags have to do with the typed-hole error message or
+-- the valid hole fits in that message. See Note [Valid hole fits include ...]
+-- in the TcHoleErrors module. These flags can all be reversed with
+-- @-fno-\<blah\>@
+fHoleFlags :: [(Deprecation, FlagSpec GeneralFlag)]
+fHoleFlags = [
+ flagSpec "show-hole-constraints" Opt_ShowHoleConstraints,
+ depFlagSpec' "show-valid-substitutions" Opt_ShowValidHoleFits
+ (useInstead "-f" "show-valid-hole-fits"),
+ flagSpec "show-valid-hole-fits" Opt_ShowValidHoleFits,
+ -- Sorting settings
+ flagSpec "sort-valid-hole-fits" Opt_SortValidHoleFits,
+ flagSpec "sort-by-size-hole-fits" Opt_SortBySizeHoleFits,
+ flagSpec "sort-by-subsumption-hole-fits" Opt_SortBySubsumHoleFits,
+ flagSpec "abstract-refinement-hole-fits" Opt_AbstractRefHoleFits,
+ -- Output format settings
+ flagSpec "show-hole-matches-of-hole-fits" Opt_ShowMatchesOfHoleFits,
+ flagSpec "show-provenance-of-hole-fits" Opt_ShowProvOfHoleFits,
+ flagSpec "show-type-of-hole-fits" Opt_ShowTypeOfHoleFits,
+ flagSpec "show-type-app-of-hole-fits" Opt_ShowTypeAppOfHoleFits,
+ flagSpec "show-type-app-vars-of-hole-fits" Opt_ShowTypeAppVarsOfHoleFits,
+ flagSpec "unclutter-valid-hole-fits" Opt_UnclutterValidHoleFits
+ ]
-- | These @-f\<blah\>@ flags can all be reversed with @-fno-\<blah\>@
fLangFlags :: [FlagSpec LangExt.Extension]
@@ -4226,9 +4259,32 @@ defaultFlags settings
++ default_PIC platform
++ concatMap (wayGeneralFlags platform) (defaultWays settings)
+ ++ validHoleFitDefaults
where platform = sTargetPlatform settings
+-- | These are the default settings for the display and sorting of valid hole
+-- fits in typed-hole error messages. See Note [Valid hole fits include ...]
+ -- in the TcHoleErrors module.
+validHoleFitDefaults :: [GeneralFlag]
+validHoleFitDefaults
+ = [ Opt_ShowTypeAppOfHoleFits
+ , Opt_ShowTypeOfHoleFits
+ , Opt_ShowProvOfHoleFits
+ , Opt_ShowMatchesOfHoleFits
+ , Opt_ShowValidHoleFits
+ , Opt_SortValidHoleFits
+ , Opt_SortBySizeHoleFits
+ , Opt_ShowHoleConstraints ]
+
+
+validHoleFitsImpliedGFlags :: [(GeneralFlag, TurnOnFlag, GeneralFlag)]
+validHoleFitsImpliedGFlags
+ = [ (Opt_UnclutterValidHoleFits, turnOff, Opt_ShowTypeAppOfHoleFits)
+ , (Opt_UnclutterValidHoleFits, turnOff, Opt_ShowTypeAppVarsOfHoleFits)
+ , (Opt_ShowTypeAppVarsOfHoleFits, turnOff, Opt_ShowTypeAppOfHoleFits)
+ , (Opt_UnclutterValidHoleFits, turnOff, Opt_ShowProvOfHoleFits) ]
+
default_PIC :: Platform -> [GeneralFlag]
default_PIC platform =
case (platformOS platform, platformArch platform) of
@@ -4247,7 +4303,7 @@ impliedGFlags :: [(GeneralFlag, TurnOnFlag, GeneralFlag)]
impliedGFlags = [(Opt_DeferTypeErrors, turnOn, Opt_DeferTypedHoles)
,(Opt_DeferTypeErrors, turnOn, Opt_DeferOutOfScopeVariables)
,(Opt_Strictness, turnOn, Opt_WorkerWrapper)
- ]
+ ] ++ validHoleFitsImpliedGFlags
-- General flags that are switched on/off when other general flags are switched
-- off
diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs
index 1172c0ab53..1df6cd6750 100644
--- a/compiler/typecheck/TcErrors.hs
+++ b/compiler/typecheck/TcErrors.hs
@@ -36,8 +36,7 @@ import HsExpr ( UnboundVar(..) )
import HsBinds ( PatSynBind(..) )
import Name
import RdrName ( lookupGlobalRdrEnv, lookupGRE_Name, GlobalRdrEnv
- , mkRdrUnqual, isLocalGRE, greSrcSpan, pprNameProvenance
- , GlobalRdrElt (..), globalRdrEnvElts )
+ , mkRdrUnqual, isLocalGRE, greSrcSpan )
import PrelNames ( typeableClassName, hasKey, liftedRepDataConKey, tYPETyConKey )
import Id
import Var
@@ -49,8 +48,6 @@ import ErrUtils ( ErrMsg, errDoc, pprLocErrMsg )
import BasicTypes
import ConLike ( ConLike(..))
import Util
-import TcEnv (tcLookup)
-import {-# SOURCE #-} TcSimplify ( tcCheckHoleFit, tcSubsumes )
import FastString
import Outputable
import SrcLoc
@@ -59,15 +56,14 @@ import ListSetOps ( equivClasses )
import Maybes
import Pair
import qualified GHC.LanguageExtensions as LangExt
-import FV ( fvVarList, fvVarSet, unionFV )
+import FV ( fvVarList, unionFV )
-import Control.Monad ( when, filterM, replicateM )
+import Control.Monad ( when )
import Data.Foldable ( toList )
-import Data.List ( partition, mapAccumL, nub
- , sortBy, sort, unfoldr, foldl' )
+import Data.List ( partition, mapAccumL, nub, sortBy, unfoldr )
import qualified Data.Set as Set
-import Data.Graph ( graphFromEdges, topSort )
-import Data.Function ( on )
+
+import {-# SOURCE #-} TcHoleErrors ( findValidHoleFits )
import Data.Semigroup ( Semigroup )
import qualified Data.Semigroup as Semigroup
@@ -233,13 +229,13 @@ report_unsolved mb_binds_var type_errors expr_holes
data Report
= Report { report_important :: [SDoc]
, report_relevant_bindings :: [SDoc]
- , report_valid_substitutions :: [SDoc]
+ , report_valid_hole_fits :: [SDoc]
}
instance Outputable Report where -- Debugging only
ppr (Report { report_important = imp
, report_relevant_bindings = rel
- , report_valid_substitutions = val })
+ , report_valid_hole_fits = val })
= vcat [ text "important:" <+> vcat imp
, text "relevant:" <+> vcat rel
, text "valid:" <+> vcat val ]
@@ -272,9 +268,9 @@ important doc = mempty { report_important = [doc] }
relevant_bindings :: SDoc -> Report
relevant_bindings doc = mempty { report_relevant_bindings = [doc] }
--- | Put a doc into the valid substitutions block.
-valid_substitutions :: SDoc -> Report
-valid_substitutions docs = mempty { report_valid_substitutions = [docs] }
+-- | Put a doc into the valid hole fits block.
+valid_hole_fits :: SDoc -> Report
+valid_hole_fits docs = mempty { report_valid_hole_fits = [docs] }
data TypeErrorChoice -- What to do for type errors found by the type checker
= TypeError -- A type error aborts compilation with an error message
@@ -1144,13 +1140,14 @@ mkHoleError tidy_simples ctxt ct@(CHoleCan { cc_hole = hole })
= givenConstraintsMsg ctxt
| otherwise = empty
- ; no_show_valid_substitutions <- goptM Opt_NoShowValidSubstitutions
- ; sub_msg <- if no_show_valid_substitutions then return empty
- else validSubstitutions tidy_simples ctxt ct
+ ; show_valid_hole_fits <- goptM Opt_ShowValidHoleFits
+ ; (ctxt, sub_msg) <- if show_valid_hole_fits
+ then validHoleFits ctxt tidy_simples ct
+ else return (ctxt, empty)
; mkErrorMsgFromCt ctxt ct $
important hole_msg `mappend`
relevant_bindings (binds_msg $$ constraints_msg) `mappend`
- valid_substitutions sub_msg}
+ valid_hole_fits sub_msg}
where
occ = holeOcc hole
@@ -1211,294 +1208,20 @@ mkHoleError tidy_simples ctxt ct@(CHoleCan { cc_hole = hole })
mkHoleError _ _ ct = pprPanic "mkHoleError" (ppr ct)
--- HoleFit is the type we use for a fit in valid substitutions. It contains the
--- element that was checked, the Id of that element as found by `tcLookup`,
--- and the refinement level of the fit, which is the number of extra argument
--- holes that this fit uses (e.g. if hfRefLvl is 2, the fit is for `Id _ _`).
-data HoleFit = HoleFit { hfEl :: GlobalRdrElt -- The element that was checked.
- , hfId :: Id -- the elements id in the TcM.
- , hfRefLvl :: Int } -- The number of holes in this fit
-
--- We define an Eq and Ord instance to be able to build a graph.
-instance Eq HoleFit where
- (==) = (==) `on` hfId
-
--- We compare HoleFits by their gre_name instead of their Id, since we don't
--- want our tests to be affected by the non-determinism of `nonDetCmpVar`,
--- which is used to compare Ids. When comparing, we want HoleFits with a lower
--- refinement level to come first.
-instance Ord HoleFit where
- compare a b = cmp a b
- where cmp = if (hfRefLvl a) == (hfRefLvl b)
- then compare `on` (gre_name . hfEl)
- else compare `on` hfRefLvl
-
-instance Outputable HoleFit where
- ppr = pprHoleFit False
-
--- For pretty printing hole fits, we display the name and type of the fit,
--- with added '_' to represent any extra arguments in case of a non-zero
--- refinement level.
-pprHoleFit :: Bool -> HoleFit -> SDoc
-pprHoleFit showProv hf =
- if showProv then sep [idAndTy, nest 2 provenance] else idAndTy
- where name = gre_name (hfEl hf)
- ty = varType (hfId hf)
- holeVs = hsep $ replicate (hfRefLvl hf) $ text "_"
- idAndTy = (pprPrefixOcc name <+> holeVs <+> dcolon <+> pprType ty)
- provenance = parens $ pprNameProvenance (hfEl hf)
-
-
--- See Note [Valid substitutions include ...]
-validSubstitutions :: [Ct] -> ReportErrCtxt -> Ct -> TcM SDoc
-validSubstitutions simples (CEC {cec_encl = implics}) ct | isExprHoleCt ct =
- do { rdr_env <- getGlobalRdrEnv
- ; maxVSubs <- maxValidSubstitutions <$> getDynFlags
- ; showProvenance <- not <$> goptM Opt_UnclutterValidSubstitutions
- ; graphSortSubs <- not <$> goptM Opt_NoSortValidSubstitutions
- ; refLevel <- refLevelSubstitutions <$> getDynFlags
- ; traceTc "findingValidSubstitutionsFor { " $ ppr ct
- ; traceTc "hole_lvl is:" $ ppr hole_lvl
- ; traceTc "implics are: " $ ppr implics
- ; traceTc "simples are: " $ ppr simples
- ; (searchDiscards, subs) <-
- findSubs graphSortSubs maxVSubs rdr_env 0 (wrapped_hole_ty, [])
- ; (vDiscards, sortedSubs) <-
- sortSubs graphSortSubs maxVSubs searchDiscards subs
- ; let vMsg = ppUnless (null subs) $
- hang (text "Valid substitutions include") 2 $
- (vcat (map (pprHoleFit showProvenance) sortedSubs)
- $$ ppWhen vDiscards subsDiscardMsg)
- ; refMsg <- if refLevel >= (Just 0) then
- do { maxRSubs <- maxRefSubstitutions <$> getDynFlags
- -- We can use from just, since we know that Nothing >= _ is False.
- ; let refLvls = [1..(fromJust refLevel)]
- -- We make a new refinement type for each level of refinement, where
- -- the level of refinement indicates number of additional arguments
- -- to allow.
- ; ref_tys <- mapM (\l -> mkRefTy l >>= return . (,) l) refLvls
- ; traceTc "ref_tys are" $ ppr ref_tys
- ; refDs <-
- mapM (uncurry $ findSubs graphSortSubs maxRSubs rdr_env) ref_tys
- ; (rDiscards, sortedRSubs) <-
- sortSubs graphSortSubs maxRSubs (any fst refDs) $
- concatMap snd refDs
- ; return $
- ppUnless (null sortedRSubs) $
- hang (text "Valid refinement substitutions include") 2 $
- (vcat (map (pprHoleFit showProvenance) sortedRSubs)
- $$ ppWhen rDiscards refSubsDiscardMsg) }
- else return empty
- ; traceTc "findingValidSubstitutionsFor }" empty
- ; return (vMsg $$ refMsg)}
- where
- hole_loc = ctEvLoc $ ctEvidence ct
- hole_lvl = ctLocLevel $ hole_loc
-
- -- We make a refinement type by adding a new type variable in front
- -- of the type of t h hole, going from e.g. [Integer] -> Integer
- -- to t_a1/m[tau:1] -> [Integer] -> Integer. This allows the simplifier
- -- to unify the new type variable with any type, allowing us
- -- to suggest a "refinement substitution", like `(foldl1 _)` instead
- -- of only concrete substitutions like `sum`.
- mkRefTy :: Int -> TcM (TcType, [TcType])
- mkRefTy refLvl = (\v -> (wrapHoleWithArgs v, v)) <$> newTyVarTys
- where newTyVarTys = replicateM refLvl newOpenFlexiTyVarTy
- wrapHoleWithArgs args = (wrap_ty . mkFunTys args) hole_ty
-
-
- sortSubs :: Bool -- Whether we should sort the subs or not
- -- by subsumption or not
- -> Maybe Int -- How many we should output, if limited.
- -> Bool -- Whether there were any discards in the
- -- initial search
- -> [HoleFit] -- The subs to sort
- -> TcM (Bool, [HoleFit])
- -- If we don't want to sort by the subsumption graph, we just sort it
- -- such that local fits come before global fits, since local fits are
- -- probably more relevant to the user.
- sortSubs False _ discards subs = return (discards, sortedFits)
- where (lclFits, gblFits) = partition (gre_lcl . hfEl) subs
- sortedFits = lclFits ++ gblFits
- -- We sort the fits first, to prevent the order of
- -- suggestions being effected when identifiers are moved
- -- around in modules. We use (<*>) to expose the
- -- parallelism, in case it becomes useful later.
- sortSubs _ limit _ subs = possiblyDiscard limit <$>
- ((++) <$> sortByGraph (sort lclFits)
- <*> sortByGraph (sort gblFits))
- where (lclFits, gblFits) = partition (gre_lcl . hfEl) subs
-
-
- findSubs :: Bool -- Whether we should sort the subs or not
- -> Maybe Int -- How many we should output, if limited
- -> GlobalRdrEnv -- The elements to check whether fit
- -> Int -- The refinement level of the hole
- -> (TcType, [TcType]) -- The type to check for fits and ref vars
- -> TcM (Bool, [HoleFit])
- -- We don't check if no output is desired.
- findSubs _ (Just 0) _ _ _ = return (False, [])
- findSubs sortSubs maxSubs rdr_env refLvl ht@(hole_ty, _) =
- do { traceTc "checkingSubstitutionsFor {" $ ppr $ hole_ty
- ; let limit = if sortSubs then Nothing else maxSubs
- ; (discards, subs) <- setTcLevel hole_lvl $
- go limit ht refLvl $
- globalRdrEnvElts rdr_env
- ; traceTc "}" empty
- ; return (discards, subs) }
- -- We extract the type of the hole from the constraint.
- hole_ty :: TcPredType
- hole_ty = ctPred ct
- 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.
- wrap_ty :: TcType -> TcSigmaType
- wrap_ty ty = foldl' wrapTypeWithImplication ty implics
-
- wrapped_hole_ty :: TcSigmaType
- wrapped_hole_ty = wrap_ty hole_ty
-
- -- 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.
- localsFirst :: [HoleFit] -> [HoleFit]
- localsFirst elts = lcl ++ gbl
- where (lcl, gbl) = partition (gre_lcl . hfEl) elts
-
-
- -- 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 :: TcType -> TcM TCvSubst
- getHoleCloningSubst hole_ty = mkTvSubstPrs <$> getClonedVars
- where cloneFV :: TyVar -> TcM (TyVar, Type)
- cloneFV fv = ((,) fv) <$> pushTcLevelM_ (newFlexiTyVarTy (varType fv))
- -- The subsumption check pushes the level, so as to be sure that
- -- its invocation of the solver doesn't unify type variables floating
- -- about that are unrelated to the subsumption check. However, these
- -- cloned variables in the hole type *should* be unified, so we make
- -- sure to bump the level before creating them
-
- getClonedVars :: TcM [(TyVar, Type)]
- getClonedVars = mapM cloneFV (fvVarList $ tyCoFVsOfType hole_ty)
-
- -- 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 :: (TcType, [TcType]) -> Type -> TcM Bool
- fitsHole (hole_ty, vars) typ =
- do { traceTc "checkingFitOf {" $ ppr typ
- ; cloneSub <- getHoleCloningSubst hole_ty
- ; let cHoleTy = substTy cloneSub hole_ty
- cCts = map (applySubToCt cloneSub) relevantCts
- cVars = map (substTy cloneSub) vars
-
- ; absFits <- tcCheckHoleFit (listToBag cCts) cHoleTy typ
- ; traceTc "}" empty
- -- We'd like to avoid refinement suggestions like `id _ _` or
- -- `head _ _`, and only suggest refinements where our all phantom
- -- variables got unified during the checking. This can be disabled
- -- with the `-fabstract-refinement-substitutions` flag.
- ; if absFits && (not . null) vars then
- goptM Opt_AbstractRefSubstitutions `orM`
- allM isFilledMetaTyVar (fvVarList $ tyCoFVsOfTypes cVars)
- else return absFits }
-
- -- Based on the flags, we might possibly discard some or all the
- -- fits we've found.
- possiblyDiscard :: Maybe Int -> [HoleFit] -> (Bool, [HoleFit])
- possiblyDiscard (Just max) fits = (fits `lengthExceeds` max, take max fits)
- possiblyDiscard Nothing fits = (False, fits)
-
- -- Based on a suggestion by phadej on #ghc, we can sort the found fits
- -- by constructing a subsumption graph, and then do a topological sort of
- -- the graph. This makes the most specific types appear first, which are
- -- probably those most relevant. This takes a lot of work (but results in
- -- much more useful output), and can be disabled by
- -- '-fno-sort-valid-substitutions'.
- sortByGraph :: [HoleFit] -> TcM [HoleFit]
- sortByGraph fits = go [] fits
- where hfType :: HoleFit -> TcSigmaType
- hfType = varType . hfId
-
- go :: [(HoleFit, [HoleFit])] -> [HoleFit] -> TcM [HoleFit]
- go sofar [] = do { traceTc "subsumptionGraph was" $ ppr sofar
- ; return $ localsFirst topSorted }
- where toV (hf, adjs) = (hf, hfId hf, map hfId adjs)
- (graph, fromV, _) = graphFromEdges $ map toV sofar
- topSorted = map ((\(h,_,_) -> h) . fromV) $ topSort graph
- go sofar (id:ids) =
- do { adjs <- filterM (tcSubsumes (hfType id) . hfType) fits
- ; go ((id, adjs):sofar) ids }
-
- -- Kickoff the checking of the elements.
- go :: Maybe Int -> (TcType, [TcType]) -> Int
- -> [GlobalRdrElt] -> TcM (Bool, [HoleFit])
- go = go_ []
-
- -- We iterate over the elements, checking each one in turn for whether it
- -- fits, and adding it to the results if it does.
- go_ :: [HoleFit] -- What we've found so far.
- -> Maybe Int -- How many we're allowed to find, if limited
- -> (TcType, [TcType]) -- The type to check, and refinement variables.
- -> Int -- The refinement level of the hole we're checking
- -> [GlobalRdrElt] -- The elements we've yet to check.
- -> TcM (Bool, [HoleFit])
- go_ subs _ _ _ [] = return (False, reverse subs)
- go_ subs (Just 0) _ _ _ = return (True, reverse subs)
- go_ subs maxleft t r (el:elts) =
- do { traceTc "lookingUp" $ ppr el
- ; maybeThing <- lookup (gre_name el)
- ; case maybeThing of
- Just id -> do { fits <- fitsHole t (varType id)
- ; if fits then keep_it (HoleFit el id r)
- else discard_it }
- _ -> discard_it }
- where discard_it = go_ subs maxleft t r elts
- keep_it fit = go_ (fit:subs) ((\n -> n - 1) <$> maxleft) t r 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
-
+-- We unwrap the ReportErrCtxt here, to avoid introducing a loop in module
+-- imports
+validHoleFits :: ReportErrCtxt -- The context we're in, i.e. the
+ -- implications and the tidy environment
+ -> [Ct] -- Unsolved simple constraints
+ -> Ct -- The hole constraint.
+ -> TcM (ReportErrCtxt, SDoc) -- We return the new context
+ -- with a possibly updated
+ -- tidy environment, and
+ -- the message.
+validHoleFits ctxt@(CEC {cec_encl = implics
+ , cec_tidy = lcl_env}) simps ct
+ = do { (tidy_env, msg) <- findValidHoleFits lcl_env implics simps ct
+ ; return (ctxt {cec_tidy = tidy_env}, msg) }
-- See Note [Constraints include ...]
givenConstraintsMsg :: ReportErrCtxt -> SDoc
@@ -1539,135 +1262,6 @@ mkIPErr ctxt cts
(ct1:_) = cts
{-
-Note [Valid substitutions include ...]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-`validSubstitutions` returns the "Valid substitutions include ..." message.
-For example, look at the following definitions in a file called test.hs:
-
- import Data.List (inits)
-
- f :: [String]
- f = _ "hello, world"
-
-The hole in `f` would generate the 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
- 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’))
- read :: forall a. Read a => String -> a
- (imported from ‘Prelude’ at test.hs:1:8-11
- (and originally defined in ‘Text.Read’))
- 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’))
- repeat :: forall a. a -> [a]
- (imported from ‘Prelude’ at test.hs:1:8-11
- (and originally defined in ‘GHC.List’))
- mempty :: forall a. Monoid a => a
- (imported from ‘Prelude’ at test.hs:1:8-11
- (and originally defined in ‘GHC.Base’))
- 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’))
- 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’))
- 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’))
- 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’))
-
-
-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. When outputting, take the fits found for
-the hole and build a subsumption graph, where fit a and fit b are connected if
-a subsumes b. We then sort the graph topologically, and output the suggestions
-in that order. This is done in order to display "more relevant" suggestions
-first where the most specific suggestions (i.e. the ones that are subsumed by
-the other suggestions) appear first. This puts suggestions such as `error` and
-`undefined` last, as seen in the example above.
-
-When the flag `-frefinement-level-substitutions=n` where `n > 0` is passed, we
-also look for valid refinement substitutions, i.e. substitutions that are valid,
-but adds more holes. Consider the following:
-
- f :: [Integer] -> Integer
- f = _
-
-Here the valid substitutions suggested will be (with the
-`-funclutter-valid-substitutions` flag set):
-
- Valid substitutions include
- f :: [Integer] -> Integer
- product :: forall (t :: * -> *).
- Foldable t => forall a. Num a => t a -> a
- sum :: forall (t :: * -> *).
- Foldable t => forall a. Num a => t a -> a
- maximum :: forall (t :: * -> *).
- Foldable t => forall a. Ord a => t a -> a
- minimum :: forall (t :: * -> *).
- Foldable t => forall a. Ord a => t a -> a
- head :: forall a. [a] -> a
- (Some substitutions suppressed;
- use -fmax-valid-substitutions=N or -fno-max-valid-substitutions)
-
-When the `-frefinement-level-substitutions=1` flag is given, we additionally
-compute and report valid refinement substitutions:
-
- Valid refinement substitutions include
- foldl1 _ :: forall (t :: * -> *).
- Foldable t => forall a. (a -> a -> a) -> t a -> a
- foldr1 _ :: forall (t :: * -> *).
- Foldable t => forall a. (a -> a -> a) -> t a -> a
- head _ :: forall a. [a] -> a
- last _ :: forall a. [a] -> a
- error _ :: forall (a :: TYPE r).
- GHC.Stack.Types.HasCallStack => [Char] -> a
- errorWithoutStackTrace _ :: forall (a :: TYPE r). [Char] -> a
- (Some refinement substitutions suppressed;
- use -fmax-refinement-substitutions=N or -fno-max-refinement-substitutions)
-
-Which are substitutions with holes in them. This allows e.g. beginners to
-discover the fold functions and similar.
-
-We find these refinement suggestions by considering substitutions that don't
-fit the type of the hole, but ones that would fit if given an additional
-argument. We do this by creating a new type variable with `newOpenFlexiTyVarTy`
-(e.g. `t_a1/m[tau:1]`), and then considering substitutions of the type
-`t_a1/m[tau:1] -> v` where `v` is the type of the hole. Since the simplifier is
-free to unify this new type variable with any type (and it is cloned before each
-check to avoid side-effects), we can now discover any identifiers that would fit
-if given another identifier of a suitable type. This is then generalized so that
-we can consider any number of additional arguments by setting the
-`-frefinement-level-substitutions` flag to any number, and then considering
-substitutions like e.g. `foldl _ _` with two additional arguments.
Note [Constraints include ...]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -3291,7 +2885,7 @@ relevantBindings want_filtering ctxt ct
; (tidy_env', docs, discards)
<- go dflags env1 ct_tvs (maxRelevantBinds dflags)
emptyVarSet [] False
- (remove_shadowing $ tcl_bndrs lcl_env)
+ (removeBindingShadowing $ tcl_bndrs lcl_env)
-- tcl_bndrs has the innermost bindings first,
-- which are probably the most relevant ones
@@ -3317,15 +2911,6 @@ relevantBindings want_filtering ctxt ct
dec_max :: Maybe Int -> Maybe Int
dec_max = fmap (\n -> n - 1)
- ---- fixes #12177
- ---- builds up a list of bindings whose OccName has not been seen before
- remove_shadowing :: [TcBinder] -> [TcBinder]
- remove_shadowing bindings = reverse $ fst $ foldl
- (\(bindingAcc, seenNames) binding ->
- if (occName binding) `elemOccSet` seenNames -- if we've seen it
- then (bindingAcc, seenNames) -- skip it
- else (binding:bindingAcc, extendOccSet seenNames (occName binding)))
- ([], emptyOccSet) bindings
go :: DynFlags -> TidyEnv -> TcTyVarSet -> Maybe Int -> TcTyVarSet -> [SDoc]
-> Bool -- True <=> some filtered out due to lack of fuel
@@ -3383,21 +2968,11 @@ relevantBindings want_filtering ctxt ct
else go dflags tidy_env' ct_tvs (dec_max n_left) new_seen
(doc:docs) discards tc_bndrs }
+
discardMsg :: SDoc
discardMsg = text "(Some bindings suppressed;" <+>
text "use -fmax-relevant-binds=N or -fno-max-relevant-binds)"
-subsDiscardMsg :: SDoc
-subsDiscardMsg =
- text "(Some substitutions suppressed;" <+>
- text "use -fmax-valid-substitutions=N or -fno-max-valid-substitutions)"
-
-refSubsDiscardMsg :: SDoc
-refSubsDiscardMsg =
- text "(Some refinement substitutions suppressed;" <+>
- text "use -fmax-refinement-substitutions=N" <+>
- text "or -fno-max-refinement-substitutions)"
-
-----------------------
warnDefaulting :: [Ct] -> Type -> TcM ()
warnDefaulting wanteds default_ty
diff --git a/compiler/typecheck/TcHoleErrors.hs b/compiler/typecheck/TcHoleErrors.hs
new file mode 100644
index 0000000000..e624d000dd
--- /dev/null
+++ b/compiler/typecheck/TcHoleErrors.hs
@@ -0,0 +1,917 @@
+{-# OPTIONS_GHC -fno-warn-orphans #-} -- We don't want to spread the HasOccName
+ -- instance for Either
+module TcHoleErrors ( findValidHoleFits ) where
+
+import GhcPrelude
+
+import TcRnTypes
+import TcRnMonad
+import TcMType
+import TcEvidence
+import TcType
+import Type
+import DataCon
+import Name
+import RdrName ( pprNameProvenance , GlobalRdrElt (..), globalRdrEnvElts )
+import PrelNames ( gHC_ERR )
+import Id
+import VarSet
+import VarEnv
+import Bag
+import ConLike ( ConLike(..) )
+import Util
+import TcEnv (tcLookup)
+import Outputable
+import DynFlags
+import Maybes
+import FV ( fvVarList, fvVarSet, unionFV, mkFVs, FV )
+
+import Control.Arrow ( (&&&) )
+
+import Control.Monad ( filterM, replicateM )
+import Data.List ( partition, sort, sortOn, nubBy, foldl' )
+import Data.Graph ( graphFromEdges, topSort )
+import Data.Function ( on )
+
+
+import TcSimplify ( simpl_top, runTcSDeriveds )
+import TcUnify ( tcSubType_NC )
+
+{-
+Note [Valid hole fits include ...]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+`findValidHoleFits` returns the "Valid hole fits include ..." message.
+For example, look at the following definitions in a file called test.hs:
+
+ import Data.List (inits)
+
+ f :: [String]
+ f = _ "hello, world"
+
+The hole in `f` would generate the 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 hole fits include
+ lines :: String -> [String]
+ (imported from ‘Prelude’ at mpt.hs:3:8-9
+ (and originally defined in ‘base-4.11.0.0:Data.OldList’))
+ words :: String -> [String]
+ (imported from ‘Prelude’ at mpt.hs:3:8-9
+ (and originally defined in ‘base-4.11.0.0:Data.OldList’))
+ inits :: forall a. [a] -> [[a]]
+ with inits @Char
+ (imported from ‘Data.List’ at mpt.hs:4:19-23
+ (and originally defined in ‘base-4.11.0.0:Data.OldList’))
+ repeat :: forall a. a -> [a]
+ with repeat @String
+ (imported from ‘Prelude’ at mpt.hs:3:8-9
+ (and originally defined in ‘GHC.List’))
+ fail :: forall (m :: * -> *). Monad m => forall a. String -> m a
+ with fail @[] @String
+ (imported from ‘Prelude’ at mpt.hs:3:8-9
+ (and originally defined in ‘GHC.Base’))
+ return :: forall (m :: * -> *). Monad m => forall a. a -> m a
+ with return @[] @String
+ (imported from ‘Prelude’ at mpt.hs:3:8-9
+ (and originally defined in ‘GHC.Base’))
+ pure :: forall (f :: * -> *). Applicative f => forall a. a -> f a
+ with pure @[] @String
+ (imported from ‘Prelude’ at mpt.hs:3:8-9
+ (and originally defined in ‘GHC.Base’))
+ read :: forall a. Read a => String -> a
+ with read @[String]
+ (imported from ‘Prelude’ at mpt.hs:3:8-9
+ (and originally defined in ‘Text.Read’))
+ mempty :: forall a. Monoid a => a
+ with mempty @([Char] -> [String])
+ (imported from ‘Prelude’ at mpt.hs:3:8-9
+ (and originally defined in ‘GHC.Base’))
+
+Valid hole fits are found by checking top level identifiers and local bindings
+in scope for whether their type can be instantiated to the the type of the hole.
+Additionally, we also need to check whether all relevant constraints are solved
+by choosing an identifier of that type as well, see Note [Relevant Constraints]
+
+Since checking for subsumption results in the side-effect of type variables
+being unified by the simplifier, we need to take care to restore them after
+to being flexible type variables after we've checked for subsumption.
+This is to avoid affecting the hole and later checks by prematurely having
+unified one of the free unification variables.
+
+When outputting, we sort the hole fits by the size of the types we'd need to
+apply by type application to the type of the fit to to make it fit. This is done
+in order to display "more relevant" suggestions first. Another option is to
+sort by building a subsumption graph of fits, i.e. a graph of which fits subsume
+what other fits, and then outputting those fits which are are subsumed by other
+fits (i.e. those more specific than other fits) first. This results in the ones
+"closest" to the type of the hole to be displayed first.
+
+To help users understand how the suggested fit works, we also display the values
+that the quantified type variables would take if that fit is used, like
+`mempty @([Char] -> [String])` and `pure @[] @String` in the example above.
+If -XTypeApplications is enabled, this can even be copied verbatim as a
+replacement for the hole.
+
+
+Note [Nested implications]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+For the simplifier to be able to use any givens present in the enclosing
+implications to solve relevant constraints, we nest the wanted subsumption
+constraints and relevant constraints within the enclosing implications.
+
+As an example, let's look at the following code:
+
+ f :: Show a => a -> String
+ f x = show _
+
+The hole will result in the hole constraint:
+
+ [WD] __a1ph {0}:: a0_a1pd[tau:2] (CHoleCan: ExprHole(_))
+
+Here the nested implications are just one level deep, namely:
+
+ [Implic {
+ TcLevel = 2
+ Skolems = a_a1pa[sk:2]
+ No-eqs = True
+ Status = Unsolved
+ Given = $dShow_a1pc :: Show a_a1pa[sk:2]
+ Wanted =
+ WC {wc_simple =
+ [WD] __a1ph {0}:: a_a1pd[tau:2] (CHoleCan: ExprHole(_))
+ [WD] $dShow_a1pe {0}:: Show a_a1pd[tau:2] (CDictCan(psc))}
+ Binds = EvBindsVar<a1pi>
+ Needed inner = []
+ Needed outer = []
+ the type signature for:
+ f :: forall a. Show a => a -> String }]
+
+As we can see, the givens say that the information about the skolem
+`a_a1pa[sk:2]` fulfills the Show constraint.
+
+The simples are:
+
+ [[WD] __a1ph {0}:: a0_a1pd[tau:2] (CHoleCan: ExprHole(_)),
+ [WD] $dShow_a1pe {0}:: Show a0_a1pd[tau:2] (CNonCanonical)]
+
+I.e. the hole `a0_a1pd[tau:2]` and the constraint that the type of the hole must
+fulfill `Show a0_a1pd[tau:2])`.
+
+So when we run the check, we need to make sure that the
+
+ [WD] $dShow_a1pe {0}:: Show a0_a1pd[tau:2] (CNonCanonical)
+
+Constraint gets solved. When we now check for whether `x :: a0_a1pd[tau:2]` fits
+the hole in `tcCheckHoleFit`, the call to `tcSubType` will end up writing the
+meta type variable `a0_a1pd[tau:2] := a_a1pa[sk:2]`. By wrapping the wanted
+constraints needed by tcSubType_NC and the relevant constraints (see
+Note [Relevant Constraints] for more details) in the nested implications, we
+can pass the information in the givens along to the simplifier. For our example,
+we end up needing to check whether the following constraints are soluble.
+
+ WC {wc_impl =
+ Implic {
+ TcLevel = 2
+ Skolems = a_a1pa[sk:2]
+ No-eqs = True
+ Status = Unsolved
+ Given = $dShow_a1pc :: Show a_a1pa[sk:2]
+ Wanted =
+ WC {wc_simple =
+ [WD] $dShow_a1pe {0}:: Show a0_a1pd[tau:2] (CNonCanonical)}
+ Binds = EvBindsVar<a1pl>
+ Needed inner = []
+ Needed outer = []
+ the type signature for:
+ f :: forall a. Show a => a -> String }}
+
+But since `a0_a1pd[tau:2] := a_a1pa[sk:2]` and we have from the nested
+implications that Show a_a1pa[sk:2] is a given, this is trivial, and we end up
+with a final WC of WC {}, confirming x :: a0_a1pd[tau:2] as a match.
+
+To avoid side-effects on the nested implications, we create a new EvBindsVar so
+that any changes to the ev binds during a check remains localised to that check.
+
+
+Note [Valid refinement hole fits include ...]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+When the `-frefinement-level-hole-fits=N` flag is given, we additionally look
+for "valid refinement hole fits"", i.e. valid hole fits with up to N
+additional holes in them.
+
+With `-frefinement-level-hole-fits=0` (the default), GHC will find all
+identifiers 'f' (top-level or nested) that will fit in the hole.
+
+With `-frefinement-level-hole-fits=1`, GHC will additionally find all
+applications 'f _' that will fit in the hole, where 'f' is an in-scope
+identifier, applied to single argument. It will also report the type of the
+needed argument (a new hole).
+
+And similarly as the number of arguments increases
+
+As an example, let's look at the following code:
+
+ f :: [Integer] -> Integer
+ f = _
+
+with `-frefinement-level-hole-fits=1`, we'd get:
+
+ Valid refinement hole fits include
+
+ foldl1 (_ :: Integer -> Integer -> Integer)
+ with foldl1 @[] @Integer
+ where foldl1 :: forall (t :: * -> *).
+ Foldable t =>
+ forall a. (a -> a -> a) -> t a -> a
+ foldr1 (_ :: Integer -> Integer -> Integer)
+ with foldr1 @[] @Integer
+ where foldr1 :: forall (t :: * -> *).
+ Foldable t =>
+ forall a. (a -> a -> a) -> t a -> a
+ const (_ :: Integer)
+ with const @Integer @[Integer]
+ where const :: forall a b. a -> b -> a
+ ($) (_ :: [Integer] -> Integer)
+ with ($) @'GHC.Types.LiftedRep @[Integer] @Integer
+ where ($) :: forall a b. (a -> b) -> a -> b
+ fail (_ :: String)
+ with fail @((->) [Integer]) @Integer
+ where fail :: forall (m :: * -> *).
+ Monad m =>
+ forall a. String -> m a
+ return (_ :: Integer)
+ with return @((->) [Integer]) @Integer
+ where return :: forall (m :: * -> *). Monad m => forall a. a -> m a
+ (Some refinement hole fits suppressed;
+ use -fmax-refinement-hole-fits=N or -fno-max-refinement-hole-fits)
+
+Which are hole fits with holes in them. This allows e.g. beginners to
+discover the fold functions and similar, but also allows for advanced users
+to figure out the valid functions in the Free monad, e.g.
+
+ instance Functor f => Monad (Free f) where
+ Pure a >>= f = f a
+ Free f >>= g = Free (fmap _a f)
+
+Will output (with -frefinment-level-hole-fits=1):
+ Found hole: _a :: Free f a -> Free f b
+ Where: ‘a’, ‘b’ are rigid type variables bound by
+ the type signature for:
+ (>>=) :: forall a b. Free f a -> (a -> Free f b) -> Free f b
+ at fms.hs:25:12-14
+ ‘f’ is a rigid type variable bound by
+ ...
+ Relevant bindings include
+ g :: a -> Free f b (bound at fms.hs:27:16)
+ f :: f (Free f a) (bound at fms.hs:27:10)
+ (>>=) :: Free f a -> (a -> Free f b) -> Free f b
+ (bound at fms.hs:25:12)
+ ...
+ Valid refinement hole fits include
+ ...
+ (=<<) (_ :: a -> Free f b)
+ with (=<<) @(Free f) @a @b
+ where (=<<) :: forall (m :: * -> *) a b.
+ Monad m =>
+ (a -> m b) -> m a -> m b
+ (imported from ‘Prelude’ at fms.hs:5:18-22
+ (and originally defined in ‘GHC.Base’))
+ ...
+
+Where `(=<<) _` is precisely the function we want (we ultimately want `>>= g`).
+
+We find these refinement suggestions by considering hole fits that don't
+fit the type of the hole, but ones that would fit if given an additional
+argument. We do this by creating a new type variable with `newOpenFlexiTyVar`
+(e.g. `t_a1/m[tau:1]`), and then considering hole fits of the type
+`t_a1/m[tau:1] -> v` where `v` is the type of the hole.
+
+Since the simplifier is free to unify this new type variable with any type, we
+can discover any identifiers that would fit if given another identifier of a
+suitable type. This is then generalized so that we can consider any number of
+additional arguments by setting the `-frefinement-level-hole-fits` flag to any
+number, and then considering hole fits like e.g. `foldl _ _` with two additional
+arguments.
+
+To make sure that the refinement hole fits are useful, we check that the types
+of the additional holes have a concrete value and not just an invented type
+variable. This eliminates suggestions such as `head (_ :: [t0 -> a]) (_ :: t0)`,
+and limits the number of less than useful refinement hole fits.
+
+Additionally, to further aid the user in their implementation, we show the
+types of the holes the binding would have to be applied to in order to work.
+In the free monad example above, this is demonstrated with
+`(=<<) (_ :: a -> Free f b)`, which tells the user that the `(=<<)` needs to
+be applied to an expression of type `a -> Free f b` in order to match.
+If -XScopedTypeVariables is enabled, this hole fit can even be copied verbatim.
+
+
+Note [Relevant Constraints]
+~~~~~~~~~~~~~~~~~~~
+
+As highlighted by Trac #14273, we need to check any relevant constraints as well
+as checking for subsumption. Relevant constraints are the simple constraints
+whose free unification variables are mentioned in the type of the hole.
+
+In the simplest case, these are all non-hole constraints in the simples, such
+as is the case in
+
+ f :: String
+ f = show _
+
+Where the simples will be :
+
+ [[WD] __a1kz {0}:: a0_a1kv[tau:1] (CHoleCan: ExprHole(_)),
+ [WD] $dShow_a1kw {0}:: Show a0_a1kv[tau:1] (CNonCanonical)]
+
+However, when there are multiple holes, we need to be more careful. As an
+example, Let's take a look at the following code:
+
+ f :: Show a => a -> String
+ f x = show (_b (show _a))
+
+Here there are two holes, `_a` and `_b`, and the simple constraints passed to
+findValidHoleFits are:
+
+ [[WD] _a_a1pi {0}:: String
+ -> a0_a1pd[tau:2] (CHoleCan: ExprHole(_b)),
+ [WD] _b_a1ps {0}:: a1_a1po[tau:2] (CHoleCan: ExprHole(_a)),
+ [WD] $dShow_a1pe {0}:: Show a0_a1pd[tau:2] (CNonCanonical),
+ [WD] $dShow_a1pp {0}:: Show a1_a1po[tau:2] (CNonCanonical)]
+
+
+Here we have the two hole constraints for `_a` and `_b`, but also additional
+constraints that these holes must fulfill. When we are looking for a match for
+the hole `_a`, we filter the simple constraints to the "Relevant constraints",
+by throwing out all hole constraints and any constraints which do not mention
+a variable mentioned in the type of the hole. For hole `_a`, we will then
+only require that the `$dShow_a1pp` constraint is solved, since that is
+the only non-hole constraint that mentions any free type variables mentioned in
+the hole constraint for `_a`, namely `a_a1pd[tau:2]` , and similarly for the
+hole `_b` we only require that the `$dShow_a1pe` constraint is solved.
+
+-}
+
+
+
+
+data HoleFitDispConfig = HFDC { showWrap :: Bool
+ , showWrapVars :: Bool
+ , showType :: Bool
+ , showProv :: Bool
+ , showMatches :: Bool }
+
+debugHoleFitDispConfig :: HoleFitDispConfig
+debugHoleFitDispConfig = HFDC True True True False False
+
+
+-- We read the various -no-show-*-of-hole-fits flags
+-- and set the display config accordingly.
+getHoleFitDispConfig :: TcM HoleFitDispConfig
+getHoleFitDispConfig
+ = do { sWrap <- goptM Opt_ShowTypeAppOfHoleFits
+ ; sWrapVars <- goptM Opt_ShowTypeAppVarsOfHoleFits
+ ; sType <- goptM Opt_ShowTypeOfHoleFits
+ ; sProv <- goptM Opt_ShowProvOfHoleFits
+ ; sMatc <- goptM Opt_ShowMatchesOfHoleFits
+ ; return HFDC{ showWrap = sWrap, showWrapVars = sWrapVars
+ , showProv = sProv, showType = sType
+ , showMatches = sMatc } }
+
+-- Which sorting algorithm to use
+data SortingAlg = NoSorting -- Do not sort the fits at all
+ | BySize -- Sort them by the size of the match
+ | BySubsumption -- Sort by full subsumption
+ deriving (Eq, Ord)
+
+getSortingAlg :: TcM SortingAlg
+getSortingAlg =
+ do { shouldSort <- goptM Opt_SortValidHoleFits
+ ; subsumSort <- goptM Opt_SortBySubsumHoleFits
+ ; sizeSort <- goptM Opt_SortBySizeHoleFits
+ -- We default to sizeSort unless it has been explicitly turned off
+ -- or subsumption sorting has been turned on.
+ ; return $ if not shouldSort
+ then NoSorting
+ else if subsumSort
+ then BySubsumption
+ else if sizeSort
+ then BySize
+ else NoSorting }
+
+-- HoleFit is the type we use for valid hole fits. It contains the
+-- element that was checked, the Id of that element as found by `tcLookup`,
+-- and the refinement level of the fit, which is the number of extra argument
+-- holes that this fit uses (e.g. if hfRefLvl is 2, the fit is for `Id _ _`).
+data HoleFit = HoleFit { hfElem :: Maybe GlobalRdrElt -- The element that was
+ -- if a global, nothing
+ -- if it is a local.
+ , hfId :: Id -- The elements id in the TcM
+ , hfType :: TcType -- The type of the id, possibly zonked
+ , hfRefLvl :: Int -- The number of holes in this fit
+ , hfWrap :: [TcType] -- The wrapper for the match
+ , hfMatches :: [TcType] } -- What the refinement
+ -- variables got matched with,
+ -- if anything
+
+-- We define an Eq and Ord instance to be able to build a graph.
+instance Eq HoleFit where
+ (==) = (==) `on` hfId
+
+-- We compare HoleFits by their gre_name instead of their Id, since we don't
+-- want our tests to be affected by the non-determinism of `nonDetCmpVar`,
+-- which is used to compare Ids. When comparing, we want HoleFits with a lower
+-- refinement level to come first.
+instance Ord HoleFit where
+ compare a b = cmp a b
+ where cmp = if hfRefLvl a == hfRefLvl b
+ then compare `on` (idName . hfId)
+ else compare `on` hfRefLvl
+
+instance Outputable HoleFit where
+ ppr = pprHoleFit debugHoleFitDispConfig
+
+instance (HasOccName a, HasOccName b) => HasOccName (Either a b) where
+ occName = either occName occName
+
+instance HasOccName GlobalRdrElt where
+ occName = occName . gre_name
+
+
+-- For pretty printing hole fits, we display the name and type of the fit,
+-- with added '_' to represent any extra arguments in case of a non-zero
+-- refinement level.
+pprHoleFit :: HoleFitDispConfig -> HoleFit -> SDoc
+pprHoleFit (HFDC sWrp sWrpVars sTy sProv sMs) hf = hang display 2 provenance
+ where name = case hfElem hf of
+ Just gre -> gre_name gre
+ Nothing -> idName (hfId hf)
+ ty = hfType hf
+ matches = hfMatches hf
+ wrap = hfWrap hf
+ tyApp = sep $ map ((text "@" <>) . pprParendType) wrap
+ tyAppVars = sep $ punctuate comma $
+ map (\(v,t) -> ppr v <+> text "~" <+> pprParendType t) $
+ zip vars wrap
+ where
+ vars = unwrapTypeVars ty
+ -- Attempts to get all the quantified type variables in a type,
+ -- e.g.
+ -- return :: forall (m :: * -> *) Monad m => (forall a . a) -> m a
+ -- into [m, a]
+ unwrapTypeVars :: Type -> [TyVar]
+ unwrapTypeVars t = vars ++ case splitFunTy_maybe unforalled of
+ Just (_, unfunned) -> unwrapTypeVars unfunned
+ _ -> []
+ where (vars, unforalled) = splitForAllTys t
+ holeVs = sep $ map (parens . (text "_" <+> dcolon <+>) . ppr) matches
+ holeDisp = if sMs then holeVs
+ else sep $ replicate (length matches) $ text "_"
+ occDisp = pprPrefixOcc name
+ tyDisp = ppWhen sTy $ dcolon <+> ppr ty
+ has = not . null
+ wrapDisp = ppWhen (has wrap && (sWrp || sWrpVars))
+ $ text "with" <+> if sWrp || not sTy
+ then occDisp <+> tyApp
+ else tyAppVars
+ funcInfo = ppWhen (has matches && sTy) $
+ text "where" <+> occDisp <+> tyDisp
+ subDisp = occDisp <+> if has matches then holeDisp else tyDisp
+ display = subDisp $$ nest 2 (funcInfo $+$ wrapDisp)
+ provenance = ppWhen sProv $
+ parens $
+ case hfElem hf of
+ Just gre -> pprNameProvenance gre
+ Nothing -> text "bound at" <+> ppr (getSrcLoc name)
+
+getLocalBindings :: TidyEnv -> Ct -> TcM [Id]
+getLocalBindings tidy_orig ct
+ = do { (env1, _) <- zonkTidyOrigin tidy_orig (ctLocOrigin loc)
+ ; go env1 [] (removeBindingShadowing $ tcl_bndrs lcl_env) }
+ where
+ loc = ctEvLoc (ctEvidence ct)
+ lcl_env = ctLocEnv loc
+
+ go :: TidyEnv -> [Id] -> [TcBinder] -> TcM [Id]
+ go _ sofar [] = return (reverse sofar)
+ go env sofar (tc_bndr : tc_bndrs) =
+ case tc_bndr of
+ TcIdBndr id _ -> keep_it id
+ _ -> discard_it
+ where
+ discard_it = go env sofar tc_bndrs
+ keep_it id = go env (id:sofar) tc_bndrs
+
+-- See Note [Valid hole fits include ...]
+findValidHoleFits :: TidyEnv --The tidy_env for zonking
+ -> [Implication] --Enclosing implications for givens
+ -> [Ct] -- The unsolved simple constraints in the
+ -- implication for the hole.
+ -> Ct -- The hole constraint itself
+ -> TcM (TidyEnv, SDoc)
+findValidHoleFits tidy_env implics simples ct | isExprHoleCt ct =
+ do { rdr_env <- getGlobalRdrEnv
+ ; lclBinds <- getLocalBindings tidy_env ct
+ ; maxVSubs <- maxValidHoleFits <$> getDynFlags
+ ; hfdc <- getHoleFitDispConfig
+ ; sortingAlg <- getSortingAlg
+ ; refLevel <- refLevelHoleFits <$> getDynFlags
+ ; traceTc "findingValidHoleFitsFor { " $ ppr ct
+ ; traceTc "hole_lvl is:" $ ppr hole_lvl
+ ; traceTc "implics are: " $ ppr implics
+ ; traceTc "simples are: " $ ppr simples
+ ; traceTc "locals are: " $ ppr lclBinds
+ ; let (lcl, gbl) = partition gre_lcl (globalRdrEnvElts rdr_env)
+ -- We remove binding shadowings here, but only for the local level.
+ -- this is so we e.g. suggest the global fmap from the Functor class
+ -- even though there is a local definition as well, such as in the
+ -- Free monad example.
+ locals = removeBindingShadowing $ map Left lclBinds ++ map Right lcl
+ globals = map Right gbl
+ to_check = locals ++ globals
+ ; (searchDiscards, subs) <-
+ findSubs sortingAlg maxVSubs to_check (hole_ty, [])
+ ; (tidy_env, tidy_subs) <- zonkSubs tidy_env subs
+ ; tidy_sorted_subs <- sortFits sortingAlg tidy_subs
+ ; let (pVDisc, limited_subs) = possiblyDiscard maxVSubs tidy_sorted_subs
+ vDiscards = pVDisc || searchDiscards
+ ; let vMsg = ppUnless (null limited_subs) $
+ hang (text "Valid hole fits include") 2 $
+ vcat (map (pprHoleFit hfdc) limited_subs)
+ $$ ppWhen vDiscards subsDiscardMsg
+ -- Refinement hole fits. See Note [Valid refinement hole fits include ...]
+ ; (tidy_env, refMsg) <- if refLevel >= Just 0 then
+ do { maxRSubs <- maxRefHoleFits <$> getDynFlags
+ -- We can use from just, since we know that Nothing >= _ is False.
+ ; let refLvls = [1..(fromJust refLevel)]
+ -- We make a new refinement type for each level of refinement, where
+ -- the level of refinement indicates number of additional arguments
+ -- to allow.
+ ; ref_tys <- mapM mkRefTy refLvls
+ ; traceTc "ref_tys are" $ ppr ref_tys
+ ; refDs <- mapM (findSubs sortingAlg maxRSubs to_check) ref_tys
+ ; (tidy_env, tidy_rsubs) <- zonkSubs tidy_env $ concatMap snd refDs
+ ; tidy_sorted_rsubs <- sortFits sortingAlg tidy_rsubs
+ -- For refinement substitutions we want matches
+ -- like id (_ :: t), head (_ :: [t]), asTypeOf (_ :: t),
+ -- and others in that vein to appear last, since these are
+ -- unlikely to be the most relevant fits.
+ ; (tidy_env, tidy_hole_ty) <- zonkTidyTcType tidy_env hole_ty
+ ; let hasExactApp = any (tcEqType tidy_hole_ty) . hfWrap
+ (exact, not_exact) = partition hasExactApp tidy_sorted_rsubs
+ (pRDisc, exact_last_rfits) =
+ possiblyDiscard maxRSubs $ not_exact ++ exact
+ rDiscards = pRDisc || any fst refDs
+ ; return (tidy_env,
+ ppUnless (null tidy_sorted_rsubs) $
+ hang (text "Valid refinement hole fits include") 2 $
+ vcat (map (pprHoleFit hfdc) exact_last_rfits)
+ $$ ppWhen rDiscards refSubsDiscardMsg) }
+ else return (tidy_env, empty)
+ ; traceTc "findingValidHoleFitsFor }" empty
+ ; return (tidy_env, vMsg $$ refMsg) }
+ where
+ -- We extract the type, the tcLevel and the types free variables
+ -- from from the constraint.
+ hole_ty :: TcPredType
+ hole_ty = ctPred ct
+ hole_fvs = tyCoFVsOfType hole_ty
+ hole_lvl = ctLocLevel $ ctEvLoc $ ctEvidence ct
+
+ -- We make a refinement type by adding a new type variable in front
+ -- of the type of t h hole, going from e.g. [Integer] -> Integer
+ -- to t_a1/m[tau:1] -> [Integer] -> Integer. This allows the simplifier
+ -- to unify the new type variable with any type, allowing us
+ -- to suggest a "refinement hole fit", like `(foldl1 _)` instead
+ -- of only concrete hole fits like `sum`.
+ mkRefTy :: Int -> TcM (TcType, [TcTyVar])
+ mkRefTy refLvl = (wrapWithVars &&& id) <$> newTyVars
+ where newTyVars = replicateM refLvl $ setLvl <$>
+ (newOpenTypeKind >>= newFlexiTyVar)
+ setLvl = flip setMetaTyVarTcLevel hole_lvl
+ wrapWithVars vars = mkFunTys (map mkTyVarTy vars) hole_ty
+
+ sortFits :: SortingAlg -- How we should sort the hole fits
+ -> [HoleFit] -- The subs to sort
+ -> TcM [HoleFit]
+ sortFits NoSorting subs = return subs
+ sortFits BySize subs
+ = (++) <$> sortBySize (sort lclFits)
+ <*> sortBySize (sort gblFits)
+ where (lclFits, gblFits) = span isLocalHoleFit subs
+
+ -- To sort by subsumption, we invoke the sortByGraph function, which
+ -- builds the subsumption graph for the fits and then sorts them using a
+ -- graph sort. Since we want locals to come first anyway, we can sort
+ -- them separately. The substitutions are already checked in local then
+ -- global order, so we can get away with using span here.
+ -- We use (<*>) to expose the parallelism, in case it becomes useful later.
+ sortFits BySubsumption subs
+ = (++) <$> sortByGraph (sort lclFits)
+ <*> sortByGraph (sort gblFits)
+ where (lclFits, gblFits) = span isLocalHoleFit subs
+
+ isLocalHoleFit :: HoleFit -> Bool
+ isLocalHoleFit hf = case hfElem hf of
+ Just gre -> gre_lcl gre
+ Nothing -> True
+
+ -- See Note [Relevant Constraints]
+ relevantCts :: [Ct]
+ relevantCts = if isEmptyVarSet (fvVarSet hole_fvs) then []
+ else filter isRelevant simples
+ where ctFreeVarSet :: Ct -> VarSet
+ ctFreeVarSet = fvVarSet . tyCoFVsOfType . ctPred
+ hole_fv_set = fvVarSet hole_fvs
+ anyFVMentioned :: Ct -> Bool
+ anyFVMentioned ct = not $ isEmptyVarSet $
+ ctFreeVarSet ct `intersectVarSet` hole_fv_set
+ -- 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 hole fits for many holes at once.
+ isRelevant ct = not (isEmptyVarSet (ctFreeVarSet ct))
+ && anyFVMentioned ct
+ && not (isHoleCt ct)
+
+ unfoldWrapper :: HsWrapper -> [Type]
+ unfoldWrapper = reverse . unfWrp'
+ where unfWrp' (WpTyApp ty) = [ty]
+ unfWrp' (WpCompose w1 w2) = unfWrp' w1 ++ unfWrp' w2
+ unfWrp' _ = []
+
+
+ -- We only clone flexi type variables, and we need to be able to check
+ -- whether a variable is filled or not.
+ isFlexiTyVar :: TcTyVar -> TcM Bool
+ isFlexiTyVar tv | isMetaTyVar tv = isFlexi <$> readMetaTyVar tv
+ isFlexiTyVar _ = return False
+
+ -- Takes a list of free variables and makes sure that the given action
+ -- is run with the right TcLevel and restores any Flexi type
+ -- variables after the action is run.
+ withoutUnification :: FV -> TcM a -> TcM a
+ withoutUnification free_vars action
+ = do { flexis <- filterM isFlexiTyVar fuvs
+ ; result <- setTcLevel deepestFreeTyVarLvl action
+ -- Reset any mutated free variables
+ ; mapM_ restore flexis
+ ; return result }
+ where restore = flip writeTcRef Flexi . metaTyVarRef
+ fuvs = fvVarList free_vars
+ deepestFreeTyVarLvl = foldl' max topTcLevel $ map tcTyVarLevel fuvs
+
+ -- The real work happens here, where we invoke the type checker using
+ -- tcCheckHoleFit to see whether the given type fits the hole.
+ fitsHole :: (TcType, [TcTyVar]) -- The type of the hole wrapped with the
+ -- refinement variables created to simulate
+ -- additional holes (if any), and the list
+ -- of those variables (possibly empty).
+ -- As an example: If the actual type of the
+ -- hole (as specified by the hole
+ -- constraint CHoleExpr passed to
+ -- findValidHoleFits) is t and we want to
+ -- simulate N additional holes, h_ty will
+ -- be r_1 -> ... -> r_N -> t, and
+ -- ref_vars will be [r_1, ... , r_N].
+ -- In the base case with no additional
+ -- holes, h_ty will just be t and ref_vars
+ -- will be [].
+ -> TcType -- The type we're checking to whether it can be
+ -- instantiated to the type h_ty.
+ -> TcM (Maybe ([TcType], [TcType])) -- If it is not a match, we
+ -- return Nothing. Otherwise,
+ -- we Just return the list of
+ -- types that quantified type
+ -- variables in ty would take
+ -- if used in place of h_ty,
+ -- and the list types of any
+ -- additional holes simulated
+ -- with the refinement
+ -- variables in ref_vars.
+ fitsHole (h_ty, ref_vars) ty =
+ -- We wrap this with the withoutUnification to avoid having side-effects
+ -- beyond the check, but we rely on the side-effects when looking for
+ -- refinement hole fits, so we can't wrap the side-effects deeper than this.
+ withoutUnification fvs $
+ do { traceTc "checkingFitOf {" $ ppr ty
+ ; (fits, wrp) <- tcCheckHoleFit (listToBag relevantCts) implics h_ty ty
+ ; traceTc "Did it fit?" $ ppr fits
+ ; traceTc "wrap is: " $ ppr wrp
+ ; traceTc "checkingFitOf }" empty
+ ; z_wrp_tys <- zonkTcTypes (unfoldWrapper wrp)
+ -- We'd like to avoid refinement suggestions like `id _ _` or
+ -- `head _ _`, and only suggest refinements where our all phantom
+ -- variables got unified during the checking. This can be disabled
+ -- with the `-fabstract-refinement-hole-fits` flag.
+ -- Here we do the additional handling when there are refinement
+ -- variables, i.e. zonk them to read their final value to check for
+ -- abstract refinements, and to report what the type of the simulated
+ -- holes must be for this to be a match.
+ ; if fits
+ then if null ref_vars
+ then return (Just (z_wrp_tys, []))
+ else do { let -- To be concrete matches, matches have to
+ -- be more than just an invented type variable.
+ fvSet = fvVarSet fvs
+ notAbstract :: TcType -> Bool
+ notAbstract t = case getTyVar_maybe t of
+ Just tv -> tv `elemVarSet` fvSet
+ _ -> True
+ allConcrete = all notAbstract z_wrp_tys
+ ; z_vars <- zonkTcTyVars ref_vars
+ ; let z_mtvs = mapMaybe tcGetTyVar_maybe z_vars
+ ; allFilled <- not <$> anyM isFlexiTyVar z_mtvs
+ ; allowAbstract <- goptM Opt_AbstractRefHoleFits
+ ; if allowAbstract || (allFilled && allConcrete )
+ then return $ Just (z_wrp_tys, z_vars)
+ else return Nothing }
+ else return Nothing }
+ where fvs = mkFVs ref_vars `unionFV` hole_fvs `unionFV` tyCoFVsOfType ty
+
+ -- We zonk the hole fits so that the output aligns with the rest
+ -- of the typed hole error message output.
+ zonkSubs :: TidyEnv -> [HoleFit] -> TcM (TidyEnv, [HoleFit])
+ zonkSubs = zonkSubs' []
+ where zonkSubs' zs env [] = return (env, reverse zs)
+ zonkSubs' zs env (hf:hfs) = do { (env', z) <- zonkSub env hf
+ ; zonkSubs' (z:zs) env' hfs }
+ zonkSub env hf@HoleFit{hfType = ty, hfMatches = m, hfWrap = wrp}
+ = do { (env, ty') <- zonkTidyTcType env ty
+ ; (env, m') <- zonkTidyTcTypes env m
+ ; (env, wrp') <- zonkTidyTcTypes env wrp
+ ; let zFit = hf {hfType = ty', hfMatches = m', hfWrap = wrp'}
+ ; return (env, zFit ) }
+
+ -- Based on the flags, we might possibly discard some or all the
+ -- fits we've found.
+ possiblyDiscard :: Maybe Int -> [HoleFit] -> (Bool, [HoleFit])
+ possiblyDiscard (Just max) fits = (fits `lengthExceeds` max, take max fits)
+ possiblyDiscard Nothing fits = (False, fits)
+
+
+ -- Sort by size uses as a measure for relevance the sizes of the
+ -- different types needed to instantiate the fit to the type of the hole.
+ -- This is much quicker than sorting by subsumption, and gives reasonable
+ -- results in most cases.
+ sortBySize :: [HoleFit] -> TcM [HoleFit]
+ sortBySize = return . sortOn sizeOfFit
+ where sizeOfFit :: HoleFit -> TypeSize
+ sizeOfFit = sizeTypes . nubBy tcEqType . hfWrap
+
+ -- Based on a suggestion by phadej on #ghc, we can sort the found fits
+ -- by constructing a subsumption graph, and then do a topological sort of
+ -- the graph. This makes the most specific types appear first, which are
+ -- probably those most relevant. This takes a lot of work (but results in
+ -- much more useful output), and can be disabled by
+ -- '-fno-sort-valid-hole-fits'.
+ sortByGraph :: [HoleFit] -> TcM [HoleFit]
+ sortByGraph fits = go [] fits
+ where tcSubsumesWCloning :: TcType -> TcType -> TcM Bool
+ tcSubsumesWCloning ht ty = withoutUnification fvs (tcSubsumes ht ty)
+ where fvs = tyCoFVsOfTypes [ht,ty]
+ go :: [(HoleFit, [HoleFit])] -> [HoleFit] -> TcM [HoleFit]
+ go sofar [] = do { traceTc "subsumptionGraph was" $ ppr sofar
+ ; return $ uncurry (++)
+ $ partition isLocalHoleFit topSorted }
+ where toV (hf, adjs) = (hf, hfId hf, map hfId adjs)
+ (graph, fromV, _) = graphFromEdges $ map toV sofar
+ topSorted = map ((\(h,_,_) -> h) . fromV) $ topSort graph
+ go sofar (hf:hfs) =
+ do { adjs <-
+ filterM (tcSubsumesWCloning (hfType hf) . hfType) fits
+ ; go ((hf, adjs):sofar) hfs }
+
+ findSubs :: SortingAlg -- Whether we should sort the subs or not
+ -> Maybe Int -- How many we should output, if limited
+ -> [Either Id GlobalRdrElt] -- The elements to check whether fit
+ -> (TcType, [TcTyVar]) -- The type to check for fits and refinement
+ -- variables for emulating additional holes
+ -> TcM (Bool, [HoleFit]) -- We return whether or not we stopped due
+ -- to running out of gas and the fits we
+ -- found.
+ -- We don't check if no output is desired.
+ findSubs _ (Just 0) _ _ = return (False, [])
+ findSubs sortAlg maxSubs to_check ht@(hole_ty, _) =
+ do { traceTc "checkingFitsFor {" $ ppr hole_ty
+ -- If we're not going to sort anyway, we can stop going after
+ -- having found `maxSubs` hole fits.
+ ; let limit = if sortAlg > NoSorting then Nothing else maxSubs
+ ; (discards, subs) <- go [] emptyVarSet limit ht to_check
+ ; traceTc "checkingFitsFor }" empty
+ ; return (discards, subs) }
+ where
+ -- Kickoff the checking of the elements.
+ -- We iterate over the elements, checking each one in turn for whether
+ -- it fits, and adding it to the results if it does.
+ go :: [HoleFit] -- What we've found so far.
+ -> VarSet -- Ids we've already checked
+ -> Maybe Int -- How many we're allowed to find, if limited
+ -> (TcType, [TcTyVar]) -- The type, and its refinement variables.
+ -> [Either Id GlobalRdrElt] -- The elements we've yet to check.
+ -> TcM (Bool, [HoleFit])
+ go subs _ _ _ [] = return (False, reverse subs)
+ go subs _ (Just 0) _ _ = return (True, reverse subs)
+ go subs seen maxleft ty (el:elts) =
+ do { traceTc "lookingUp" $ ppr el
+ ; maybeThing <- lookup el
+ ; case maybeThing of
+ Just id | not_trivial id ->
+ do { fits <- fitsHole ty (idType id)
+ ; case fits of
+ Just (wrp, matches) -> keep_it id wrp matches
+ _ -> discard_it }
+ _ -> discard_it }
+ where discard_it = go subs seen maxleft ty elts
+ keep_it id wrp ms = go (fit:subs) (extendVarSet seen id)
+ ((\n -> n - 1) <$> maxleft) ty elts
+ where fit = HoleFit { hfElem = mbel , hfId = id
+ , hfType = idType id
+ , hfRefLvl = length (snd ty)
+ , hfWrap = wrp , hfMatches = ms }
+ mbel = either (const Nothing) Just el
+ -- We want to filter out undefined and the likes from GHC.Err
+ not_trivial id = nameModule_maybe (idName id) /= Just gHC_ERR
+ lookup :: Either Id GlobalRdrElt -> TcM (Maybe Id)
+ lookup (Left id) = return $ Just id
+ lookup (Right el) =
+ do { thing <- tcLookup (gre_name el)
+ ; 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.
+findValidHoleFits env _ _ _ = return (env, empty)
+
+subsDiscardMsg :: SDoc
+subsDiscardMsg =
+ text "(Some hole fits suppressed;" <+>
+ text "use -fmax-valid-hole-fits=N" <+>
+ text "or -fno-max-valid-hole-fits)"
+
+refSubsDiscardMsg :: SDoc
+refSubsDiscardMsg =
+ text "(Some refinement hole fits suppressed;" <+>
+ text "use -fmax-refinement-hole-fits=N" <+>
+ text "or -fno-max-refinement-hole-fits)"
+
+
+-- | Reports whether first type (ty_a) subsumes the second type (ty_b),
+-- discarding any errors. Subsumption here means that the ty_b can fit into the
+-- ty_a, i.e. `tcSubsumes a b == True` if b is a subtype of a.
+tcSubsumes :: TcSigmaType -> TcSigmaType -> TcM Bool
+tcSubsumes ty_a ty_b = fst <$> tcCheckHoleFit emptyBag [] ty_a ty_b
+
+
+-- | A tcSubsumes which takes into account relevant constraints, to fix trac
+-- #14273. This makes sure that when checking whether a type fits the hole,
+-- the type has to be subsumed by type of the hole as well as fulfill all
+-- constraints on the type of the hole.
+-- Note: The simplifier may perform unification, so make sure to restore any
+-- free type variables to avoid side-effects.
+tcCheckHoleFit :: Cts -- Any relevant Cts to the hole.
+ -> [Implication] -- The nested implications of the hole
+ -> TcSigmaType -- The type of the hole.
+ -> TcSigmaType -- The type to check whether fits.
+ -> TcM (Bool, HsWrapper)
+tcCheckHoleFit _ _ hole_ty ty | hole_ty `eqType` ty
+ = return (True, idHsWrapper)
+tcCheckHoleFit relevantCts implics hole_ty ty = discardErrs $
+ do { (wrp, wanted) <- captureConstraints $ tcSubType_NC ExprSigCtxt ty hole_ty
+ ; traceTc "Checking hole fit {" empty
+ ; traceTc "wanteds are: " $ ppr wanted
+ -- We add the relevantCts to the wanteds generated by the call to
+ -- tcSubType_NC, see Note [Relevant Constraints]
+ ; let w_rel_cts = addSimples wanted relevantCts
+ ; if isEmptyWC w_rel_cts
+ then traceTc "}" empty >> return (True, wrp)
+ else do { fresh_binds <- newTcEvBinds
+ -- We wrap the WC in the nested implications, see
+ -- Note [Nested Implications]
+ ; let outermost_first = reverse implics
+ setWC = setWCAndBinds fresh_binds
+ w_givens = foldr setWC w_rel_cts outermost_first
+ ; traceTc "w_givens are: " $ ppr w_givens
+ ; rem <- runTcSDeriveds $ simpl_top w_givens
+ -- We don't want any insoluble or simple constraints left, but
+ -- solved implications are ok (and neccessary for e.g. undefined)
+ ; traceTc "rems was:" $ ppr rem
+ ; traceTc "}" empty
+ ; return (isSolvedWC rem, wrp) } }
+ where
+ setWCAndBinds :: EvBindsVar -- Fresh ev binds var.
+ -> Implication -- The implication to put WC in.
+ -> WantedConstraints -- The WC constraints to put implic.
+ -> WantedConstraints -- The new constraints.
+ setWCAndBinds binds imp wc
+ = WC { wc_simple = emptyBag
+ , wc_impl = unitBag $ imp { ic_wanted = wc , ic_binds = binds } }
diff --git a/compiler/typecheck/TcHoleErrors.hs-boot b/compiler/typecheck/TcHoleErrors.hs-boot
new file mode 100644
index 0000000000..16e0c953c0
--- /dev/null
+++ b/compiler/typecheck/TcHoleErrors.hs-boot
@@ -0,0 +1,12 @@
+-- This boot file is in place to break the loop where:
+-- + TcSimplify calls 'TcErrors.reportUnsolved',
+-- + which calls 'TcHoleErrors.findValidHoleFits`
+-- + which calls 'TcSimplify.simpl_top'
+module TcHoleErrors where
+
+import TcRnTypes ( TcM, Ct, Implication )
+import Outputable ( SDoc )
+import VarEnv ( TidyEnv )
+
+findValidHoleFits :: TidyEnv -> [Implication] -> [Ct] -> Ct
+ -> TcM (TidyEnv, SDoc)
diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs
index e4e98548bd..89741d2c4b 100644
--- a/compiler/typecheck/TcMType.hs
+++ b/compiler/typecheck/TcMType.hs
@@ -65,7 +65,7 @@ module TcMType (
--------------------------------
-- Zonking and tidying
- zonkTidyTcType, zonkTidyOrigin,
+ zonkTidyTcType, zonkTidyTcTypes, zonkTidyOrigin,
tidyEvVar, tidyCt, tidySkolemInfo,
skolemiseRuntimeUnk,
zonkTcTyVar, zonkTcTyVars,
@@ -1624,6 +1624,13 @@ zonkTidyTcType :: TidyEnv -> TcType -> TcM (TidyEnv, TcType)
zonkTidyTcType env ty = do { ty' <- zonkTcType ty
; return (tidyOpenType env ty') }
+zonkTidyTcTypes :: TidyEnv -> [TcType] -> TcM (TidyEnv, [TcType])
+zonkTidyTcTypes = zonkTidyTcTypes' []
+ where zonkTidyTcTypes' zs env [] = return (env, reverse zs)
+ zonkTidyTcTypes' zs env (ty:tys)
+ = do { (env', ty') <- zonkTidyTcType env ty
+ ; zonkTidyTcTypes' (ty':zs) env' tys }
+
zonkTidyOrigin :: TidyEnv -> CtOrigin -> TcM (TidyEnv, CtOrigin)
zonkTidyOrigin env (GivenOrigin skol_info)
= do { skol_info1 <- zonkSkolemInfo skol_info
diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs
index 17d9504f37..4be3e5efd1 100644
--- a/compiler/typecheck/TcRnTypes.hs
+++ b/compiler/typecheck/TcRnTypes.hs
@@ -83,7 +83,7 @@ module TcRnTypes(
tyCoVarsOfCtList, tyCoVarsOfCtsList,
WantedConstraints(..), insolubleWC, emptyWC, isEmptyWC,
- andWC, unionsWC, mkSimpleWC, mkImplicWC,
+ isSolvedWC, andWC, unionsWC, mkSimpleWC, mkImplicWC,
addInsols, insolublesOnly, addSimples, addImplics,
tyCoVarsOfWC, dropDerivedWC, dropDerivedSimples,
tyCoVarsOfWCList, insolubleWantedCt, insolubleEqCt,
@@ -113,6 +113,7 @@ module TcRnTypes(
ctEvRole,
wrapType, wrapTypeWithImplication,
+ removeBindingShadowing,
-- Constraint solver plugins
TcPlugin(..), TcPluginResult(..), TcPluginSolver,
@@ -935,6 +936,23 @@ instance HasOccName TcBinder where
occName (TcIdBndr_ExpType name _ _) = occName name
occName (TcTvBndr name _) = occName name
+-- fixes #12177
+-- Builds up a list of bindings whose OccName has not been seen before
+-- i.e., If ys = removeBindingShadowing xs
+-- then
+-- - ys is obtained from xs by deleting some elements
+-- - ys has no duplicate OccNames
+-- - The first duplicated OccName in xs is retained in ys
+-- Overloaded so that it can be used for both GlobalRdrElt in typed-hole
+-- substitutions and TcBinder when looking for relevant bindings.
+removeBindingShadowing :: HasOccName a => [a] -> [a]
+removeBindingShadowing bindings = reverse $ fst $ foldl
+ (\(bindingAcc, seenNames) binding ->
+ if occName binding `elemOccSet` seenNames -- if we've seen it
+ then (bindingAcc, seenNames) -- skip it
+ else (binding:bindingAcc, extendOccSet seenNames (occName binding)))
+ ([], emptyOccSet) bindings
+
---------------------------
-- Template Haskell stages and levels
---------------------------
@@ -2303,6 +2321,14 @@ isEmptyWC :: WantedConstraints -> Bool
isEmptyWC (WC { wc_simple = f, wc_impl = i })
= isEmptyBag f && isEmptyBag i
+
+-- | Checks whether a the given wanted constraints are solved, i.e.
+-- that there are no simple constraints left and all the implications
+-- are solved.
+isSolvedWC :: WantedConstraints -> Bool
+isSolvedWC WC {wc_simple = wc_simple, wc_impl = wc_impl} =
+ isEmptyBag wc_simple && allBag (isSolvedStatus . ic_status) wc_impl
+
andWC :: WantedConstraints -> WantedConstraints -> WantedConstraints
andWC (WC { wc_simple = f1, wc_impl = i1 })
(WC { wc_simple = f2, wc_impl = i2 })
diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs
index 84f4eca30b..e6c00aea4a 100644
--- a/compiler/typecheck/TcSimplify.hs
+++ b/compiler/typecheck/TcSimplify.hs
@@ -10,8 +10,8 @@ module TcSimplify(
solveEqualities, solveLocalEqualities,
simplifyWantedsTcM,
tcCheckSatisfiability,
- tcSubsumes,
- tcCheckHoleFit,
+
+ simpl_top,
promoteTyVar,
promoteTyVarSet,
@@ -49,7 +49,6 @@ import TrieMap () -- DV: for now
import Type
import TysWiredIn ( liftedRepTy )
import Unify ( tcMatchTyKi )
-import TcUnify ( tcSubType_NC )
import Util
import Var
import VarSet
@@ -177,6 +176,8 @@ solveEqualities thing_inside
; traceTc "reportAllUnsolved }" empty
; return result }
+-- | Simplify top-level constraints, but without reporting any unsolved
+-- constraints nor unsafe overlapping.
simpl_top :: WantedConstraints -> TcS WantedConstraints
-- See Note [Top-level Defaulting Plan]
simpl_top wanteds
@@ -511,31 +512,6 @@ simplifyDefault theta
; traceTc "reportUnsolved }" empty
; return () }
--- | Reports whether first type (ty_a) subsumes the second type (ty_b),
--- discarding any errors. Subsumption here means that the ty_b can fit into the
--- ty_a, i.e. `tcSubsumes a b == True` if b is a subtype of a.
--- N.B.: Make sure that the types contain all the constraints
--- contained in any associated implications.
-tcSubsumes :: TcSigmaType -> TcSigmaType -> TcM Bool
-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 { (tclevel, wanted, _) <- pushLevelAndCaptureConstraints $
- tcSubType_NC ExprSigCtxt ty hole_ty
- ; rem <- setTcLevel tclevel $ runTcSDeriveds $
- 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)
- && allBag (isSolvedStatus . ic_status) (wc_impl rem))
- }
-
------------------
tcCheckSatisfiability :: Bag EvVar -> TcM Bool
-- Return True if satisfiable, False if definitely contradictory
@@ -1610,7 +1586,7 @@ setImplicationStatus implic@(Implic { ic_status = status
, ic_given = givens })
| ASSERT2( not (isSolvedStatus status ), ppr info )
-- Precondition: we only set the status if it is not already solved
- not all_solved
+ not (isSolvedWC pruned_wc)
= do { traceTcS "setImplicationStatus(not-all-solved) {" (ppr implic)
; implic <- neededEvVars implic
@@ -1666,9 +1642,6 @@ setImplicationStatus implic@(Implic { ic_status = status
pruned_wc = WC { wc_simple = pruned_simples
, wc_impl = pruned_implics }
- all_solved = isEmptyBag pruned_simples
- && allBag (isSolvedStatus . ic_status) pruned_implics
-
keep_me :: Implication -> Bool
keep_me ic
| IC_Solved { ics_dead = dead_givens } <- ic_status ic
diff --git a/compiler/typecheck/TcSimplify.hs-boot b/compiler/typecheck/TcSimplify.hs-boot
deleted file mode 100644
index 6455a73b6a..0000000000
--- a/compiler/typecheck/TcSimplify.hs-boot
+++ /dev/null
@@ -1,11 +0,0 @@
-module TcSimplify where
-
-import GhcPrelude
-import TcRnTypes ( TcM, Cts )
-import TcType ( TcSigmaType )
-
--- This boot file exists solely to make tcCheckHoleFit and tcSubsumes avaialble
--- in TcErrors
-
-tcSubsumes :: TcSigmaType -> TcSigmaType -> TcM Bool
-tcCheckHoleFit :: Cts -> TcSigmaType -> TcSigmaType -> TcM Bool
diff --git a/docs/users_guide/8.6.1-notes.rst b/docs/users_guide/8.6.1-notes.rst
index 25b93b8b8c..7ac572634a 100644
--- a/docs/users_guide/8.6.1-notes.rst
+++ b/docs/users_guide/8.6.1-notes.rst
@@ -109,6 +109,10 @@ Compiler
This will result in significantly better code being generated for some
programs. See :ghc-ticket:`9136`.
+- GHC now offers significantly more information about typed holes such as valid
+ hole fits and refinement hole fits. See :ref:`Valid Hole Fits <typed-hole-valid-hole-fits>`
+ for more information.
+
- The code-generation effects of :ghc-flag:`-dynamic` can now be
enabled independently by the flag
:ghc-flag:`-fexternal-dynamic-refs`. If you don't know why you might
diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst
index 01d65be73f..a705512114 100644
--- a/docs/users_guide/glasgow_exts.rst
+++ b/docs/users_guide/glasgow_exts.rst
@@ -10932,10 +10932,7 @@ will fail with the following error: ::
Relevant bindings include
x :: a (bound at hole.hs:2:3)
f :: a -> a (bound at hole.hs:2:1)
- Valid substitutions include
- undefined :: forall (a :: TYPE r). GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at hole.hs:1:1
- (and originally defined in ‘GHC.Err’))
+ Valid hole fits include x :: a (bound at hole.hs:2:3)
Here are some more details:
@@ -10981,25 +10978,25 @@ Here are some more details:
Relevant bindings include
z :: Bool (bound at Foo.hs:3:6)
cons :: Bool -> [Bool] (bound at Foo.hs:3:1)
- Valid substitutions include
+ Valid hole fits include
+ z :: Bool (bound at mpt.hs:2:6)
otherwise :: Bool
- (imported from ‘Prelude’ at Foo.hs:1:8-10
+ (imported from ‘Prelude’ at mpt.hs:1:8-10
(and originally defined in ‘GHC.Base’))
False :: Bool
- (imported from ‘Prelude’ at Foo.hs:1:8-10
+ (imported from ‘Prelude’ at mpt.hs:1:8-10
(and originally defined in ‘GHC.Types’))
True :: Bool
- (imported from ‘Prelude’ at Foo.hs:1:8-10
+ (imported from ‘Prelude’ at mpt.hs:1:8-10
(and originally defined in ‘GHC.Types’))
maxBound :: forall a. Bounded a => a
- (imported from ‘Prelude’ at Foo.hs:1:8-10
+ with maxBound @Bool
+ (imported from ‘Prelude’ at mpt.hs:1:8-10
(and originally defined in ‘GHC.Enum’))
minBound :: forall a. Bounded a => a
- (imported from ‘Prelude’ at Foo.hs:1:8-10
+ with minBound @Bool
+ (imported from ‘Prelude’ at mpt.hs:1:8-10
(and originally defined in ‘GHC.Enum’))
- undefined :: forall (a :: TYPE r). GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at Foo.hs:1:8-10
- (and originally defined in ‘GHC.Err’))
Foo.hs:3:26: error:
Variable not in scope: y :: [Bool]
@@ -11027,10 +11024,6 @@ Here are some more details:
In the expression: _x : _x
In an equation for `cons': cons = _x : _x
Relevant bindings include cons :: [a] (bound at unbound.hs:1:1)
- Valid substitutions include
- undefined :: forall (a :: TYPE r). GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at unbound.hs:1:8-11
- (and originally defined in ‘GHC.Err’))
unbound.hs:1:13:
Found hole: _x :: [a]
@@ -11042,15 +11035,14 @@ Here are some more details:
In the expression: _x : _x
In an equation for ‘cons’: cons = _x : _x
Relevant bindings include cons :: [a] (bound at unbound.hs:3:1)
- Valid substitutions include
- cons :: forall a. [a] (defined at unbound.hs:3:1)
+ Valid hole fits include
+ cons :: forall a. [a]
+ with cons @a
+ (defined at mpt.hs:3:1)
mempty :: forall a. Monoid a => a
- (imported from ‘Prelude’ at unbound.hs:1:8-11
+ with mempty @[a]
+ (imported from ‘Prelude’ at mpt.hs:1:8-10
(and originally defined in ‘GHC.Base’))
- undefined :: forall (a :: TYPE r). GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at unbound.hs:1:8-11
- (and originally defined in ‘GHC.Err’))
-
Notice the two different types reported for the two different
occurrences of ``_x``.
@@ -11074,7 +11066,7 @@ Here are some more details:
implementation terms, they are reported by the renamer rather than
the type checker.)
-- The list of valid substitutions is found by checking which bindings in scope
+- The list of valid hole fits is found by checking which bindings in scope
would fit into the hole. As an example, compiling the following module with
GHC: ::
@@ -11088,48 +11080,47 @@ Here are some more details:
.. code-block:: none
+
• 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
+ In an equation for ‘g’: g = _ "hello, world"
+ • Relevant bindings include g :: [String] (bound at mpt.hs:6:1)
+ Valid hole fits include
lines :: String -> [String]
- (imported from ‘Prelude’ at test.hs:1:8-11
- (and originally defined in ‘base-4.11.0.0:Data.OldList’))
+ (imported from ‘Prelude’ at mpt.hs:3:8-9
+ (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’))
- read :: forall a. Read a => String -> a
- (imported from ‘Prelude’ at test.hs:1:8-11
- (and originally defined in ‘Text.Read’))
+ (imported from ‘Prelude’ at mpt.hs:3:8-9
+ (and originally defined in ‘base-4.11.0.0:Data.OldList’))
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’))
+ with inits @Char
+ (imported from ‘Data.List’ at mpt.hs:4:19-23
+ (and originally defined in ‘base-4.11.0.0:Data.OldList’))
repeat :: forall a. a -> [a]
- (imported from ‘Prelude’ at test.hs:1:8-11
- (and originally defined in ‘GHC.List’))
- mempty :: forall a. Monoid a => a
- (imported from ‘Prelude’ at test.hs:1:8-11
- (and originally defined in ‘GHC.Base’))
+ with repeat @String
+ (imported from ‘Prelude’ at mpt.hs:3:8-9
+ (and originally defined in ‘GHC.List’))
+ fail :: forall (m :: * -> *). Monad m => forall a. String -> m a
+ with fail @[] @String
+ (imported from ‘Prelude’ at mpt.hs:3:8-9
+ (and originally defined in ‘GHC.Base’))
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’))
+ with return @[] @String
+ (imported from ‘Prelude’ at mpt.hs:3:8-9
+ (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’))
- 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’))
- 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’))
+ with pure @[] @String
+ (imported from ‘Prelude’ at mpt.hs:3:8-9
+ (and originally defined in ‘GHC.Base’))
+ read :: forall a. Read a => String -> a
+ with read @[String]
+ (imported from ‘Prelude’ at mpt.hs:3:8-9
+ (and originally defined in ‘Text.Read’))
+ mempty :: forall a. Monoid a => a
+ with mempty @([Char] -> [String])
+ (imported from ‘Prelude’ at mpt.hs:3:8-9
+ (and originally defined in ‘GHC.Base’))
There are a few flags for controlling the amount of context information shown
for typed holes:
@@ -11157,236 +11148,302 @@ for typed holes:
x :: a (bound at show_constraints.hs:4:3)
f :: a -> Bool (bound at show_constraints.hs:4:1)
Constraints include Eq a (from show_constraints.hs:3:1-22)
- Valid substitutions include
+ Valid hole fits include
otherwise :: Bool
- (imported from ‘Prelude’ at show_constraints.hs:1:8-11
- (and originally defined in ‘GHC.Base’))
False :: Bool
- (imported from ‘Prelude’ at show_constraints.hs:1:8-11
- (and originally defined in ‘GHC.Types’))
True :: Bool
- (imported from ‘Prelude’ at show_constraints.hs:1:8-11
- (and originally defined in ‘GHC.Types’))
maxBound :: forall a. Bounded a => a
- (imported from ‘Prelude’ at show_constraints.hs:1:8-11
- (and originally defined in ‘GHC.Enum’))
+ with maxBound @Bool
minBound :: forall a. Bounded a => a
- (imported from ‘Prelude’ at show_constraints.hs:1:8-11
- (and originally defined in ‘GHC.Enum’))
- undefined :: forall (a :: TYPE r). GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at show_constraints.hs:1:8-11
- (and originally defined in ‘GHC.Err’))
-
-.. _typed-hole-valid-substitutions:
+ with minBound @Bool
+
+.. _typed-hole-valid-hole-fits:
-Valid Substitutions
+Valid Hole Fits
-------------------
-GHC sometimes suggests valid substitutions for typed holes, which is
+GHC sometimes suggests valid hole fits for typed holes, which is
configurable by a few flags.
-.. ghc-flag:: -fno-show-valid-substitutions
- :shortdesc: Disables showing a list of valid substitutions for typed holes
+.. ghc-flag:: -fno-show-valid-hole-fits
+ :shortdesc: Disables showing a list of valid hole fits for typed holes
in type error messages.
:type: dynamic
:category: verbosity
:default: off
- This flag can be toggled to turn off the display of valid substitutions
+ This flag can be toggled to turn off the display of valid hole fits
entirely.
-.. ghc-flag:: -fno-sort-valid-substitutions
- :shortdesc: Disables the sorting of the list of valid substitutions for typed holes
- in type error messages.
+.. ghc-flag:: -fmax-valid-hole-fits=⟨n⟩
+ :shortdesc: *default: 6.* Set the maximum number of valid hole fits for
+ typed holes to display in type error messages.
:type: dynamic
+ :reverse: -fno-max-valid-hole-fits
:category: verbosity
- :default: off
+ :default: 6
- By default the valid substitutions are sorted by a topological sort on the
- subsumption graph of the identified substitutions. However, this requires
- checking relations between the found substitutions, which can be expensive
- if there are many valid substitutions. Sorting can be toggled off with this
- flag.
+ The list of valid hole fits is limited by displaying up to 6
+ hole fits per hole. The number of hole fits shown can be set by this
+ flag. Turning the limit off with :ghc-flag:`-fno-max-valid-hole-fits`
+ displays all found hole fits.
- When sorting is off, the hole in ``g`` in the following as before ::
- import Data.List (inits)
+.. ghc-flag:: -fshow-type-of-hole-fits
+ :shortdesc: Toggles whether to show the type of the valid hole fits
+ in the output.
+ :type: dynamic
+ :category: verbosity
+ :reverse: -fno-type-of-hole-fits
- g :: [String]
- g = _ "hello, world"
+ :default: on
- will yield an error:
+ By default, the hole fits show the type of the hole fit.
+ This can be turned off by the reverse of this flag.
- .. code-block:: none
+
- test.hs:6:5: error:
- • Found hole: _ :: [Char] -> [String]
- • In the expression: _
- In the expression: _ "hello, world"
- In an equation for ‘g’: g = _ "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’))
-
- where the substitutions are ordered by the order they were defined and
- imported in, with all local bindings before global bindings.
-
-.. ghc-flag:: -fmax-valid-substitutions=⟨n⟩
- :shortdesc: *default: 6.* Set the maximum number of valid substitutions for
- typed holes to display in type error messages.
+.. ghc-flag:: -fshow-type-app-of-hole-fits
+ :shortdesc: Toggles whether to show the type application of the valid
+ hole fits in the output.
:type: dynamic
- :reverse: -fno-max-valid-substitutions
:category: verbosity
+ :reverse: -fno-show-type-app-of-hole-fits
- :default: 6
+ :default: on
+
+ By default, the hole fits show the type application needed to make
+ this hole fit fit the type of the hole, e.g. for the hole
+ ``(_ :: Int -> [Int])``, ``mempty`` is a hole fit with
+ ``mempty @(Int -> [Int])``. This can be toggled off with
+ the reverse of this flag.
+
+.. ghc-flag:: -fshow-type-app-vars-of-hole-fits
+ :shortdesc: Toggles whether to show what type each quantified
+ variable takes in a valid hole fit.
+ :type: dynamic
+ :category: verbosity
+ :reverse: -fno-show-type-app-vars-of-hole-fits
+
+ :default: on
+
+ By default, the hole fits show the type application needed to make
+ this hole fit fit the type of the hole, e.g. for the hole
+ ``(_ :: Int -> [Int])``, ``mempty :: Monoid a => a`` is a hole fit
+ with ``mempty @(Int -> [Int])``. This flag toggles whether to show
+ ``a ~ (Int -> [Int])`` instead of ``mempty @(Int -> [Int])`` in the where
+ clause of the valid hole fit message.
+
+.. ghc-flag:: -fshow-provenance-of-hole-fits
+ :shortdesc: Toggles whether to show the provenance of the valid hole fits
+ in the output.
+ :type: dynamic
+ :category: verbosity
+ :reverse: -fno-show-provenance-of-hole-fits
+
+ :default: on
- The list of valid substitutions is limited by displaying up to 6
- substitutions per hole. The number of substitutions shown can be set by this
- flag. Turning the limit off with :ghc-flag:`-fno-max-valid-substitutions`
- displays all found substitutions.
+ By default, each hole fit shows the provenance information of its
+ hole fit, i.e. where it was bound or defined, and what module
+ it was originally defined in if it was imported. This can be toggled
+ off using the reverse of this flag.
+
-.. ghc-flag:: -funclutter-valid-substitutions
- :shortdesc: Unclutter the list of valid substitutions by not showing
- provenance of suggestion.
+.. ghc-flag:: -funclutter-valid-hole-fits
+ :shortdesc: Unclutter the list of valid hole fits by not showing
+ provenance nor type applications of suggestions.
:type: dynamic
:category: verbosity
:default: off
- This flag can be toggled to decrease the verbosity of the valid
- substitution suggestions by not showing the provenance the suggestions.
+ This flag can be toggled to decrease the verbosity of the valid hole fit
+ suggestions by not showing the provenance nor type application of the
+ suggestions.
-.. _typed-holes-refinement-substitutions:
-Refinement Substitutions
+
+.. _typed-holes-refinement-hole-fits:
+
+Refinement Hole Fits
~~~~~~~~~~~~~~~~~~~~~~~~
-When the flag :ghc-flag:`-frefinement-level-substitutions=⟨n⟩` is set to an
+When the flag :ghc-flag:`-frefinement-level-hole-fits=⟨n⟩` is set to an
``n`` larger than ``0``, GHC will offer up a list of valid refinement
-substitutions, which are valid substitutions that need up to ``n`` levels of
+hole fits, which are valid hole fits that need up to ``n`` levels of
additional refinement to be complete, where each level represents an additional
-hole in the substitution that requires filling in. As an example, consider the
+hole in the hole fit that requires filling in. As an example, consider the
hole in ::
f :: [Integer] -> Integer
f = _
-When the refinement level is not set, it will only offer valid substitutions
+When the refinement level is not set, it will only offer valid hole fits
suggestions: ::
- Valid substitutions include
+ Valid hole fits include
f :: [Integer] -> Integer
- product :: forall (t :: * -> *).
- Foldable t => forall a. Num a => t a -> a
- sum :: forall (t :: * -> *).
- Foldable t => forall a. Num a => t a -> a
+ head :: forall a. [a] -> a
+ with head @Integer
+ last :: forall a. [a] -> a
+ with last @Integer
maximum :: forall (t :: * -> *).
- Foldable t => forall a. Ord a => t a -> a
+ Foldable t =>
+ forall a. Ord a => t a -> a
+ with maximum @[] @Integer
minimum :: forall (t :: * -> *).
- Foldable t => forall a. Ord a => t a -> a
- head :: forall a. [a] -> a
- (Some substitutions suppressed; use -fmax-valid-substitutions=N or -fno-max-valid-substitutions)
-
-However, with :ghc-flag:`-frefinement-level-substitutions=⟨n⟩` set to e.g. `1`,
-it will additionally offer up a list of refinement substitutions, in this case: ::
-
- Valid refinement substitutions include
- foldl1 _ :: forall (t :: * -> *).
- Foldable t => forall a. (a -> a -> a) -> t a -> a
- foldr1 _ :: forall (t :: * -> *).
- Foldable t => forall a. (a -> a -> a) -> t a -> a
- head _ :: forall a. [a] -> a
- last _ :: forall a. [a] -> a
- error _ :: forall (a :: TYPE r).
- GHC.Stack.Types.HasCallStack => [Char] -> a
- errorWithoutStackTrace _ :: forall (a :: TYPE r). [Char] -> a
- (Some refinement substitutions suppressed;
- use -fmax-refinement-substitutions=N or -fno-max-refinement-substitutions)
+ Foldable t =>
+ forall a. Ord a => t a -> a
+ with minimum @[] @Integer
+ product :: forall (t :: * -> *).
+ Foldable t =>
+ forall a. Num a => t a -> a
+ with product @[] @Integer
+ sum :: forall (t :: * -> *).
+ Foldable t =>
+ forall a. Num a => t a -> a
+ with sum @[] @Integer
+
+However, with :ghc-flag:`-frefinement-level-hole-fits=⟨n⟩` set to e.g. `1`,
+it will additionally offer up a list of refinement hole fits, in this case: ::
+
+ Valid refinement hole fits include
+ foldl1 (_ :: Integer -> Integer -> Integer)
+ with foldl1 @[] @Integer
+ where foldl1 :: forall (t :: * -> *).
+ Foldable t =>
+ forall a. (a -> a -> a) -> t a -> a
+ foldr1 (_ :: Integer -> Integer -> Integer)
+ with foldr1 @[] @Integer
+ where foldr1 :: forall (t :: * -> *).
+ Foldable t =>
+ forall a. (a -> a -> a) -> t a -> a
+ const (_ :: Integer)
+ with const @Integer @[Integer]
+ where const :: forall a b. a -> b -> a
+ ($) (_ :: [Integer] -> Integer)
+ with ($) @'GHC.Types.LiftedRep @[Integer] @Integer
+ where ($) :: forall a b. (a -> b) -> a -> b
+ fail (_ :: String)
+ with fail @((->) [Integer]) @Integer
+ where fail :: forall (m :: * -> *).
+ Monad m =>
+ forall a. String -> m a
+ return (_ :: Integer)
+ with return @((->) [Integer]) @Integer
+ where return :: forall (m :: * -> *). Monad m => forall a. a -> m a
+ (Some refinement hole fits suppressed;
+ use -fmax-refinement-hole-fits=N or -fno-max-refinement-hole-fits)
Which shows that the hole could be replaced with e.g. ``foldl1 _``. While not
fixing the hole, this can help users understand what options they have.
-
-.. ghc-flag:: -frefinement-level-substitutions=⟨n⟩
+
+.. ghc-flag:: -frefinement-level-hole-fits=⟨n⟩
:shortdesc: *default: off.* Sets the level of refinement of the
- refinement substitutions, where level ``n`` means that substitutions
+ refinement hole fits, where level ``n`` means that hole fits
of up to ``n`` holes will be considered.
:type: dynamic
- :reverse: -fno-refinement-level-substitutions
+ :reverse: -fno-refinement-level-hole-fits
:category: verbosity
:default: off
- The list of valid refinement substitutions is generated by considering
- substitutions with a varying amount of additional holes. The amount of
+ The list of valid refinement hole fits is generated by considering
+ hole fits with a varying amount of additional holes. The amount of
holes in a refinement can be set by this flag. If the flag is set to 0
- or not set at all, no valid refinement substitutions will be suggested.
+ or not set at all, no valid refinement hole fits will be suggested.
-.. ghc-flag:: -fabstract-refinement-substitutions
+.. ghc-flag:: -fabstract-refinement-hole-fits
:shortdesc: *default: off.* Toggles whether refinements where one or more
or more of the holes are abstract are reported.
:type: dynamic
- :reverse: -fno-abstract-refinement-substitutions
+ :reverse: -fno-abstract-refinement-hole-fits
:category: verbosity
:default: off
- Valid list of valid refinement substitutions can often grow large when
+ Valid list of valid refinement hole fits can often grow large when
the refinement level is ``>= 2``, with holes like ``head _ _`` or
``fst _ _``, which are valid refinements, but which are unlikely to be
relevant since one or more of the holes are still completely open, in that
neither the type nor kind of those holes are constrained by the proposed
identifier at all. By default, such holes are not reported. By turning this
- flag on, such holes are included in the list of valid refinement substitutions.
+ flag on, such holes are included in the list of valid refinement hole fits.
-.. ghc-flag:: -fmax-refinement-substitutions=⟨n⟩
- :shortdesc: *default: 6.* Set the maximum number of refinement substitutions
+.. ghc-flag:: -fmax-refinement-hole-fits=⟨n⟩
+ :shortdesc: *default: 6.* Set the maximum number of refinement hole fits
for typed holes to display in type error messages.
:type: dynamic
- :reverse: -fno-max-refinement-substitutions
+ :reverse: -fno-max-refinement-hole-fits
:category: verbosity
:default: 6
- The list of valid refinement substitutions is limited by displaying up to 6
- substitutions per hole. The number of substitutions shown can be set by this
- flag. Turning the limit off with :ghc-flag:`-fno-max-refinement-substitutions`
- displays all found substitutions.
+ The list of valid refinement hole fits is limited by displaying up to 6
+ hole fits per hole. The number of hole fits shown can be set by this
+ flag. Turning the limit off with :ghc-flag:`-fno-max-refinement-hole-fits`
+ displays all found hole fits.
+
+.. ghc-flag:: -fshow-hole-matches-of-hole-fits
+ :shortdesc: Toggles whether to show the type of the additional holes
+ in refinement hole fits.
+ :type: dynamic
+ :category: verbosity
+ :reverse: -fno-show-hole-matches-of-hole-fits
+
+ :default: on
+
+ The types of the additional holes in refinement hole fits are displayed
+ in the output, e.g. ``foldl1 (_ :: a -> a -> a)`` is a refinement
+ for the hole ``_ :: [a] -> a``. If this flag is toggled off, the output
+ will display only ``foldl1 _``, which can be used as a direct replacement
+ for the hole, without requiring ``-XScopedTypeVariables``.
+
+
+
+
+Sorting Valid Hole Fits
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+There are currently two ways to sort valid hole fits.
+Sorting can be toggled with :ghc-flag:`-fsort-valid-hole-fits`
+
+.. ghc-flag:: -fno-sort-valid-hole-fits
+ :shortdesc: Disables the sorting of the list of valid hole fits for typed holes
+ in type error messages.
+ :type: dynamic
+ :category: verbosity
+
+ :default: off
+
+ By default the valid hole fits are sorted to show the most relevant
+ hole fits at the top of the list of valid hole fits. This can be
+ toggled off with this flag.
+
+.. ghc-flag:: -fsort-by-size-hole-fits
+ :shortdesc: Sort valid hole fits by size.
+ :type: dynamic
+ :reverse: -fno-sort-by-size-hole-fits
+
+ :default: on
+
+ Sorts by how big the types the quantified type variables in the type of the
+ function would have to be in order to match the type of the hole.
+
+
+.. ghc-flag:: -fsort-by-subsumption-hole-fits
+ :shortdesc: Sort valid hole fits by subsumption.
+ :type: dynamic
+ :reverse: -fno-sort-by-subsumption-hole-fits
+
+ :default: off
+
+ An alternative sort. Sorts by checking which hole fits subsume other
+ hole fits, such that if hole fit a could be used as hole fits for
+ hole fit b, then b appears before a in the output. It is more precise than
+ the default sort, but also a lot slower, since a subsumption check has to be
+ run for each pair of valid hole fits.
.. _partial-type-signatures:
diff --git a/testsuite/tests/gadt/T12468.stderr b/testsuite/tests/gadt/T12468.stderr
index 3f540931ec..402a93d82d 100644
--- a/testsuite/tests/gadt/T12468.stderr
+++ b/testsuite/tests/gadt/T12468.stderr
@@ -4,13 +4,13 @@ T12468.hs:9:7: error:
• In the expression: _
In an equation for ‘f’: f I = _
• Relevant bindings include f :: T a -> a (bound at T12468.hs:9:1)
- Valid substitutions include
+ Constraints include a ~ Int (from T12468.hs:9:3)
+ Valid hole fits include
maxBound :: forall a. Bounded a => a
+ with maxBound @Int
(imported from ‘Prelude’ at T12468.hs:3:8-13
(and originally defined in ‘GHC.Enum’))
minBound :: forall a. Bounded a => a
+ with minBound @Int
(imported from ‘Prelude’ at T12468.hs:3:8-13
(and originally defined in ‘GHC.Enum’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at T12468.hs:3:8-13
- (and originally defined in ‘GHC.Err’))
diff --git a/testsuite/tests/ghci/scripts/T10248.stderr b/testsuite/tests/ghci/scripts/T10248.stderr
index d6428c5cbd..b9cf45a8f6 100644
--- a/testsuite/tests/ghci/scripts/T10248.stderr
+++ b/testsuite/tests/ghci/scripts/T10248.stderr
@@ -9,6 +9,4 @@
In an equation for ‘it’: it = Just <$> _
• Relevant bindings include
it :: f (Maybe a) (bound at <interactive>:2:1)
- Valid substitutions include
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ (and originally defined in ‘GHC.Err’))
+ Constraints include Functor f (from <interactive>:2:1-10)
diff --git a/testsuite/tests/ghci/scripts/T10249.stderr b/testsuite/tests/ghci/scripts/T10249.stderr
index d495994e95..c8215663a5 100644
--- a/testsuite/tests/ghci/scripts/T10249.stderr
+++ b/testsuite/tests/ghci/scripts/T10249.stderr
@@ -7,6 +7,3 @@
• In the expression: _
In an equation for ‘it’: it = _
• Relevant bindings include it :: t (bound at <interactive>:1:1)
- Valid substitutions include
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ (and originally defined in ‘GHC.Err’))
diff --git a/testsuite/tests/ghci/scripts/T8353.stderr b/testsuite/tests/ghci/scripts/T8353.stderr
index 4cac123c96..a84b0b7e83 100644
--- a/testsuite/tests/ghci/scripts/T8353.stderr
+++ b/testsuite/tests/ghci/scripts/T8353.stderr
@@ -9,18 +9,17 @@ Defer03.hs:7:5: warning: [-Wtyped-holes (in -Wdefault)]
• In the expression: _
In an equation for ‘f’: f = _
• Relevant bindings include f :: Int (bound at Defer03.hs:7:1)
- Valid substitutions include
+ Valid hole fits include
+ f :: Int (bound at Defer03.hs:7:1)
a :: Int (defined at Defer03.hs:4:1)
- f :: Int (defined at Defer03.hs:7:1)
maxBound :: forall a. Bounded a => a
+ with maxBound @Int
(imported from ‘Prelude’ at Defer03.hs:1:8-11
(and originally defined in ‘GHC.Enum’))
minBound :: forall a. Bounded a => a
+ with minBound @Int
(imported from ‘Prelude’ at Defer03.hs:1:8-11
(and originally defined in ‘GHC.Enum’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at Defer03.hs:1:8-11
- (and originally defined in ‘GHC.Err’))
Defer03.hs:4:5: error:
• Couldn't match expected type ‘Int’ with actual type ‘Char’
@@ -32,18 +31,17 @@ Defer03.hs:7:5: error:
• In the expression: _
In an equation for ‘f’: f = _
• Relevant bindings include f :: Int (bound at Defer03.hs:7:1)
- Valid substitutions include
+ Valid hole fits include
+ f :: Int (bound at Defer03.hs:7:1)
a :: Int (defined at Defer03.hs:4:1)
- f :: Int (defined at Defer03.hs:7:1)
maxBound :: forall a. Bounded a => a
+ with maxBound @Int
(imported from ‘Prelude’ at Defer03.hs:1:8-11
(and originally defined in ‘GHC.Enum’))
minBound :: forall a. Bounded a => a
+ with minBound @Int
(imported from ‘Prelude’ at Defer03.hs:1:8-11
(and originally defined in ‘GHC.Enum’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at Defer03.hs:1:8-11
- (and originally defined in ‘GHC.Err’))
Defer03.hs:4:5: warning: [-Wdeferred-type-errors (in -Wdefault)]
• Couldn't match expected type ‘Int’ with actual type ‘Char’
@@ -55,18 +53,17 @@ Defer03.hs:7:5: warning: [-Wtyped-holes (in -Wdefault)]
• In the expression: _
In an equation for ‘f’: f = _
• Relevant bindings include f :: Int (bound at Defer03.hs:7:1)
- Valid substitutions include
+ Valid hole fits include
+ f :: Int (bound at Defer03.hs:7:1)
a :: Int (defined at Defer03.hs:4:1)
- f :: Int (defined at Defer03.hs:7:1)
maxBound :: forall a. Bounded a => a
+ with maxBound @Int
(imported from ‘Prelude’ at Defer03.hs:1:8-11
(and originally defined in ‘GHC.Enum’))
minBound :: forall a. Bounded a => a
+ with minBound @Int
(imported from ‘Prelude’ at Defer03.hs:1:8-11
(and originally defined in ‘GHC.Enum’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at Defer03.hs:1:8-11
- (and originally defined in ‘GHC.Err’))
Defer03.hs:4:5: error:
• Couldn't match expected type ‘Int’ with actual type ‘Char’
@@ -78,18 +75,17 @@ Defer03.hs:7:5: error:
• In the expression: _
In an equation for ‘f’: f = _
• Relevant bindings include f :: Int (bound at Defer03.hs:7:1)
- Valid substitutions include
+ Valid hole fits include
+ f :: Int (bound at Defer03.hs:7:1)
a :: Int (defined at Defer03.hs:4:1)
- f :: Int (defined at Defer03.hs:7:1)
maxBound :: forall a. Bounded a => a
+ with maxBound @Int
(imported from ‘Prelude’ at Defer03.hs:1:8-11
(and originally defined in ‘GHC.Enum’))
minBound :: forall a. Bounded a => a
+ with minBound @Int
(imported from ‘Prelude’ at Defer03.hs:1:8-11
(and originally defined in ‘GHC.Enum’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at Defer03.hs:1:8-11
- (and originally defined in ‘GHC.Err’))
Defer03.hs:4:5: warning: [-Wdeferred-type-errors (in -Wdefault)]
• Couldn't match expected type ‘Int’ with actual type ‘Char’
@@ -101,15 +97,14 @@ Defer03.hs:7:5: warning: [-Wtyped-holes (in -Wdefault)]
• In the expression: _
In an equation for ‘f’: f = _
• Relevant bindings include f :: Int (bound at Defer03.hs:7:1)
- Valid substitutions include
+ Valid hole fits include
+ f :: Int (bound at Defer03.hs:7:1)
a :: Int (defined at Defer03.hs:4:1)
- f :: Int (defined at Defer03.hs:7:1)
maxBound :: forall a. Bounded a => a
+ with maxBound @Int
(imported from ‘Prelude’ at Defer03.hs:1:8-11
(and originally defined in ‘GHC.Enum’))
minBound :: forall a. Bounded a => a
+ with minBound @Int
(imported from ‘Prelude’ at Defer03.hs:1:8-11
(and originally defined in ‘GHC.Enum’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at Defer03.hs:1:8-11
- (and originally defined in ‘GHC.Err’))
diff --git a/testsuite/tests/module/mod71.stderr b/testsuite/tests/module/mod71.stderr
index 52d0ae3e86..d877e397a0 100644
--- a/testsuite/tests/module/mod71.stderr
+++ b/testsuite/tests/module/mod71.stderr
@@ -10,7 +10,4 @@ mod71.hs:4:9: error:
• Relevant bindings include
x :: t1 -> t -> t2 (bound at mod71.hs:4:3)
f :: (t1 -> t -> t2) -> t2 (bound at mod71.hs:4:1)
- Valid substitutions include
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at mod71.hs:3:8
- (and originally defined in ‘GHC.Err’))
+ Constraints include Num t (from mod71.hs:4:1-11)
diff --git a/testsuite/tests/partial-sigs/should_compile/T12531.stderr b/testsuite/tests/partial-sigs/should_compile/T12531.stderr
index 20c44ecb12..a17062d2f0 100644
--- a/testsuite/tests/partial-sigs/should_compile/T12531.stderr
+++ b/testsuite/tests/partial-sigs/should_compile/T12531.stderr
@@ -7,7 +7,4 @@ T12531.hs:6:11: warning: [-Wtyped-holes (in -Wdefault)]
• Relevant bindings include
x :: Int# (bound at T12531.hs:6:3)
f :: Int# -> Int (bound at T12531.hs:6:1)
- Valid substitutions include
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at T12531.hs:3:8-13
- (and originally defined in ‘GHC.Err’))
+ Valid hole fits include x :: Int# (bound at T12531.hs:6:3)
diff --git a/testsuite/tests/th/T10267.stderr b/testsuite/tests/th/T10267.stderr
index 6ebda88797..0f8e2215bc 100644
--- a/testsuite/tests/th/T10267.stderr
+++ b/testsuite/tests/th/T10267.stderr
@@ -10,10 +10,7 @@ T10267.hs:8:1: error:
• Relevant bindings include
x :: a (bound at T10267.hs:8:1)
j :: a -> a (bound at T10267.hs:8:1)
- Valid substitutions include
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at T10267.hs:3:8-13
- (and originally defined in ‘GHC.Err’))
+ Valid hole fits include x :: a (bound at T10267.hs:8:1)
T10267.hs:8:1: error:
• Found hole: _foo :: a -> a
@@ -25,18 +22,24 @@ T10267.hs:8:1: error:
• In the expression: _foo
In an equation for ‘i’: i = _foo
• Relevant bindings include i :: a -> a (bound at T10267.hs:8:1)
- Valid substitutions include
- j :: forall a. a -> a (defined at T10267.hs:8:1)
- i :: forall a. a -> a (defined at T10267.hs:8:1)
- k :: forall a. a -> a (defined at T10267.hs:14:3)
- l :: forall a. a -> a (defined at T10267.hs:23:3)
- foo :: forall a. a -> a (defined at T10267.hs:33:1)
+ Valid hole fits include
+ i :: a -> a (bound at T10267.hs:8:1)
+ j :: forall a. a -> a
+ with j @a
+ (bound at T10267.hs:8:1)
+ k :: forall a. a -> a
+ with k @a
+ (defined at T10267.hs:14:3)
+ l :: forall a. a -> a
+ with l @a
+ (defined at T10267.hs:23:3)
+ foo :: forall a. a -> a
+ with foo @a
+ (defined at T10267.hs:33:1)
id :: forall a. a -> a
+ with id @a
(imported from ‘Prelude’ at T10267.hs:3:8-13
(and originally defined in ‘GHC.Base’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at T10267.hs:3:8-13
- (and originally defined in ‘GHC.Err’))
T10267.hs:14:3: error:
• Found hole: _foo :: a -> a
@@ -48,18 +51,24 @@ T10267.hs:14:3: error:
• In the expression: _foo
In an equation for ‘k’: k = _foo
• Relevant bindings include k :: a -> a (bound at T10267.hs:14:3)
- Valid substitutions include
- j :: forall a. a -> a (defined at T10267.hs:8:1)
- i :: forall a. a -> a (defined at T10267.hs:8:1)
- k :: forall a. a -> a (defined at T10267.hs:14:3)
- l :: forall a. a -> a (defined at T10267.hs:23:3)
- foo :: forall a. a -> a (defined at T10267.hs:33:1)
+ Valid hole fits include
+ k :: a -> a (bound at T10267.hs:14:3)
+ j :: forall a. a -> a
+ with j @a
+ (bound at T10267.hs:8:1)
+ i :: forall a. a -> a
+ with i @a
+ (bound at T10267.hs:8:1)
+ l :: forall a. a -> a
+ with l @a
+ (defined at T10267.hs:23:3)
+ foo :: forall a. a -> a
+ with foo @a
+ (defined at T10267.hs:33:1)
id :: forall a. a -> a
+ with id @a
(imported from ‘Prelude’ at T10267.hs:3:8-13
(and originally defined in ‘GHC.Base’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at T10267.hs:3:8-13
- (and originally defined in ‘GHC.Err’))
T10267.hs:23:3: error:
• Found hole: _ :: a
@@ -72,7 +81,4 @@ T10267.hs:23:3: error:
• Relevant bindings include
x :: a (bound at T10267.hs:23:3)
l :: a -> a (bound at T10267.hs:23:3)
- Valid substitutions include
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at T10267.hs:3:8-13
- (and originally defined in ‘GHC.Err’))
+ Valid hole fits include x :: a (bound at T10267.hs:23:3)
diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T
index e103184283..e998bd0027 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', '-fno-max-valid-substitutions -dsuppress-uniques -v0 ' + config.ghc_th_way_flags])
+ ['T10267', '-fno-max-valid-hole-fits -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 bb0b9effef..407b256d81 100644
--- a/testsuite/tests/typecheck/should_compile/T13050.stderr
+++ b/testsuite/tests/typecheck/should_compile/T13050.stderr
@@ -8,67 +8,82 @@ T13050.hs:4:9: warning: [-Wtyped-holes (in -Wdefault)]
y :: Int (bound at T13050.hs:4:5)
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)
+ Valid hole fits include
+ f :: Int -> Int -> Int (bound at T13050.hs:4:1)
+ g :: Int -> Int -> Int (bound at T13050.hs:5:1)
+ q :: Int -> Int -> Int (bound at T13050.hs:6:1)
+ seq :: forall a b. a -> b -> b
+ with seq @Int @Int
+ (imported from ‘Prelude’ at T13050.hs:1:8-17
+ (and originally defined in ‘GHC.Prim’))
+ (-) :: forall a. Num a => a -> a -> a
+ with (-) @Int
+ (imported from ‘Prelude’ at T13050.hs:1:8-17
+ (and originally defined in ‘GHC.Num’))
+ asTypeOf :: forall a. a -> a -> a
+ with asTypeOf @Int
+ (imported from ‘Prelude’ at T13050.hs:1:8-17
+ (and originally defined in ‘GHC.Base’))
+ const :: forall a b. a -> b -> a
+ with const @Int @Int
+ (imported from ‘Prelude’ at T13050.hs:1:8-17
+ (and originally defined in ‘GHC.Base’))
+ subtract :: forall a. Num a => a -> a -> a
+ with subtract @Int
+ (imported from ‘Prelude’ at T13050.hs:1:8-17
+ (and originally defined in ‘GHC.Num’))
+ (^) :: forall a b. (Num a, Integral b) => a -> b -> a
+ with (^) @Int @Int
+ (imported from ‘Prelude’ at T13050.hs:1:8-17
+ (and originally defined in ‘GHC.Real’))
gcd :: forall a. Integral a => a -> a -> a
+ with gcd @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Real’))
lcm :: forall a. Integral a => a -> a -> a
+ with lcm @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Real’))
+ (*) :: forall a. Num a => a -> a -> a
+ with (*) @Int
+ (imported from ‘Prelude’ at T13050.hs:1:8-17
+ (and originally defined in ‘GHC.Num’))
+ (+) :: forall a. Num a => a -> a -> a
+ with (+) @Int
+ (imported from ‘Prelude’ at T13050.hs:1:8-17
+ (and originally defined in ‘GHC.Num’))
div :: forall a. Integral a => a -> a -> a
+ with div @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Real’))
mod :: forall a. Integral a => a -> a -> a
+ with mod @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Real’))
quot :: forall a. Integral a => a -> a -> a
+ with quot @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Real’))
rem :: forall a. Integral a => a -> a -> a
+ with rem @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Real’))
max :: forall a. Ord a => a -> a -> a
+ with max @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Classes’))
min :: forall a. Ord a => a -> a -> a
+ with min @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Classes’))
- (^) :: forall a b. (Num a, Integral b) => a -> b -> a
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Real’))
- (-) :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Num’))
- subtract :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Num’))
- (*) :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Num’))
- (+) :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Num’))
- asTypeOf :: forall a. a -> a -> a
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Base’))
- const :: forall a b. a -> b -> a
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Base’))
return :: forall (m :: * -> *). Monad m => forall a. a -> m a
+ with return @((->) Int) @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Base’))
pure :: forall (f :: * -> *). Applicative f => forall a. a -> f a
+ with pure @((->) Int) @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Base’))
- seq :: forall a b. a -> b -> b
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Prim’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Err’))
T13050.hs:5:11: warning: [-Wtyped-holes (in -Wdefault)]
• Found hole: _ :: Int -> Int -> Int
@@ -79,67 +94,82 @@ T13050.hs:5:11: warning: [-Wtyped-holes (in -Wdefault)]
y :: Int (bound at T13050.hs:5:5)
x :: Int (bound at T13050.hs:5:3)
g :: Int -> Int -> Int (bound at T13050.hs:5:1)
- Valid substitutions include
+ Valid hole fits include
+ g :: Int -> Int -> Int (bound at T13050.hs:5:1)
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)
+ q :: Int -> Int -> Int (bound at T13050.hs:6:1)
+ seq :: forall a b. a -> b -> b
+ with seq @Int @Int
+ (imported from ‘Prelude’ at T13050.hs:1:8-17
+ (and originally defined in ‘GHC.Prim’))
+ (-) :: forall a. Num a => a -> a -> a
+ with (-) @Int
+ (imported from ‘Prelude’ at T13050.hs:1:8-17
+ (and originally defined in ‘GHC.Num’))
+ asTypeOf :: forall a. a -> a -> a
+ with asTypeOf @Int
+ (imported from ‘Prelude’ at T13050.hs:1:8-17
+ (and originally defined in ‘GHC.Base’))
+ const :: forall a b. a -> b -> a
+ with const @Int @Int
+ (imported from ‘Prelude’ at T13050.hs:1:8-17
+ (and originally defined in ‘GHC.Base’))
+ subtract :: forall a. Num a => a -> a -> a
+ with subtract @Int
+ (imported from ‘Prelude’ at T13050.hs:1:8-17
+ (and originally defined in ‘GHC.Num’))
+ (^) :: forall a b. (Num a, Integral b) => a -> b -> a
+ with (^) @Int @Int
+ (imported from ‘Prelude’ at T13050.hs:1:8-17
+ (and originally defined in ‘GHC.Real’))
gcd :: forall a. Integral a => a -> a -> a
+ with gcd @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Real’))
lcm :: forall a. Integral a => a -> a -> a
+ with lcm @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Real’))
+ (*) :: forall a. Num a => a -> a -> a
+ with (*) @Int
+ (imported from ‘Prelude’ at T13050.hs:1:8-17
+ (and originally defined in ‘GHC.Num’))
+ (+) :: forall a. Num a => a -> a -> a
+ with (+) @Int
+ (imported from ‘Prelude’ at T13050.hs:1:8-17
+ (and originally defined in ‘GHC.Num’))
div :: forall a. Integral a => a -> a -> a
+ with div @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Real’))
mod :: forall a. Integral a => a -> a -> a
+ with mod @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Real’))
quot :: forall a. Integral a => a -> a -> a
+ with quot @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Real’))
rem :: forall a. Integral a => a -> a -> a
+ with rem @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Real’))
max :: forall a. Ord a => a -> a -> a
+ with max @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Classes’))
min :: forall a. Ord a => a -> a -> a
+ with min @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Classes’))
- (^) :: forall a b. (Num a, Integral b) => a -> b -> a
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Real’))
- (-) :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Num’))
- subtract :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Num’))
- (*) :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Num’))
- (+) :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Num’))
- asTypeOf :: forall a. a -> a -> a
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Base’))
- const :: forall a b. a -> b -> a
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Base’))
return :: forall (m :: * -> *). Monad m => forall a. a -> m a
+ with return @((->) Int) @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Base’))
pure :: forall (f :: * -> *). Applicative f => forall a. a -> f a
+ with pure @((->) Int) @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Base’))
- seq :: forall a b. a -> b -> b
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Prim’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Err’))
T13050.hs:6:11: warning: [-Wtyped-holes (in -Wdefault)]
• Found hole: _a :: Int -> Int -> Int
@@ -151,64 +181,79 @@ T13050.hs:6:11: warning: [-Wtyped-holes (in -Wdefault)]
y :: Int (bound at T13050.hs:6:5)
x :: Int (bound at T13050.hs:6:3)
q :: Int -> Int -> Int (bound at T13050.hs:6:1)
- Valid substitutions include
+ Valid hole fits include
+ q :: Int -> Int -> Int (bound at T13050.hs:6:1)
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)
+ seq :: forall a b. a -> b -> b
+ with seq @Int @Int
+ (imported from ‘Prelude’ at T13050.hs:1:8-17
+ (and originally defined in ‘GHC.Prim’))
+ (-) :: forall a. Num a => a -> a -> a
+ with (-) @Int
+ (imported from ‘Prelude’ at T13050.hs:1:8-17
+ (and originally defined in ‘GHC.Num’))
+ asTypeOf :: forall a. a -> a -> a
+ with asTypeOf @Int
+ (imported from ‘Prelude’ at T13050.hs:1:8-17
+ (and originally defined in ‘GHC.Base’))
+ const :: forall a b. a -> b -> a
+ with const @Int @Int
+ (imported from ‘Prelude’ at T13050.hs:1:8-17
+ (and originally defined in ‘GHC.Base’))
+ subtract :: forall a. Num a => a -> a -> a
+ with subtract @Int
+ (imported from ‘Prelude’ at T13050.hs:1:8-17
+ (and originally defined in ‘GHC.Num’))
+ (^) :: forall a b. (Num a, Integral b) => a -> b -> a
+ with (^) @Int @Int
+ (imported from ‘Prelude’ at T13050.hs:1:8-17
+ (and originally defined in ‘GHC.Real’))
gcd :: forall a. Integral a => a -> a -> a
+ with gcd @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Real’))
lcm :: forall a. Integral a => a -> a -> a
+ with lcm @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Real’))
+ (*) :: forall a. Num a => a -> a -> a
+ with (*) @Int
+ (imported from ‘Prelude’ at T13050.hs:1:8-17
+ (and originally defined in ‘GHC.Num’))
+ (+) :: forall a. Num a => a -> a -> a
+ with (+) @Int
+ (imported from ‘Prelude’ at T13050.hs:1:8-17
+ (and originally defined in ‘GHC.Num’))
div :: forall a. Integral a => a -> a -> a
+ with div @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Real’))
mod :: forall a. Integral a => a -> a -> a
+ with mod @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Real’))
quot :: forall a. Integral a => a -> a -> a
+ with quot @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Real’))
rem :: forall a. Integral a => a -> a -> a
+ with rem @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Real’))
max :: forall a. Ord a => a -> a -> a
+ with max @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Classes’))
min :: forall a. Ord a => a -> a -> a
+ with min @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Classes’))
- (^) :: forall a b. (Num a, Integral b) => a -> b -> a
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Real’))
- (-) :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Num’))
- subtract :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Num’))
- (*) :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Num’))
- (+) :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Num’))
- asTypeOf :: forall a. a -> a -> a
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Base’))
- const :: forall a b. a -> b -> a
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Base’))
return :: forall (m :: * -> *). Monad m => forall a. a -> m a
+ with return @((->) Int) @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Base’))
pure :: forall (f :: * -> *). Applicative f => forall a. a -> f a
+ with pure @((->) Int) @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Base’))
- seq :: forall a b. a -> b -> b
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Prim’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at T13050.hs:1:8-17
- (and originally defined in ‘GHC.Err’))
diff --git a/testsuite/tests/typecheck/should_compile/T14273.stderr b/testsuite/tests/typecheck/should_compile/T14273.stderr
index 9d320c7709..f307c77ded 100644
--- a/testsuite/tests/typecheck/should_compile/T14273.stderr
+++ b/testsuite/tests/typecheck/should_compile/T14273.stderr
@@ -28,8 +28,19 @@ T14273.hs:7:32: warning: [-Wtyped-holes (in -Wdefault)]
• 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)
+ Constraints include Show a (from T14273.hs:5:1-49)
+ Valid hole fits include
+ a :: a (bound at T14273.hs:7:17)
+ k :: String (bound at T14273.hs:10:1)
+ otherwise :: Bool
+ (imported from ‘Prelude’ at T14273.hs:1:8-40
+ (and originally defined in ‘GHC.Base’))
+ 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’))
EQ :: Ordering
(imported from ‘Prelude’ at T14273.hs:1:8-40
(and originally defined in ‘GHC.Types’))
@@ -40,17 +51,9 @@ T14273.hs:7:32: warning: [-Wtyped-holes (in -Wdefault)]
(imported from ‘Prelude’ at T14273.hs:1:8-40
(and originally defined in ‘GHC.Types’))
pi :: forall a. Floating a => a
+ with pi @Double
(imported from ‘Prelude’ at T14273.hs:1:8-40
(and originally defined in ‘GHC.Float’))
- otherwise :: Bool
- (imported from ‘Prelude’ at T14273.hs:1:8-40
- (and originally defined in ‘GHC.Base’))
- 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’))
T14273.hs:13:10: warning: [-Wdeferred-type-errors (in -Wdefault)]
• Ambiguous type variable ‘a0’ arising from a use of ‘show’
@@ -77,4 +80,4 @@ T14273.hs:13:16: warning: [-Wtyped-holes (in -Wdefault)]
• 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)
+ Valid hole fits 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 0c6e23affe..2e0f784e02 100644
--- a/testsuite/tests/typecheck/should_compile/T14590.stderr
+++ b/testsuite/tests/typecheck/should_compile/T14590.stderr
@@ -8,68 +8,83 @@ T14590.hs:4:13: warning: [-Wtyped-holes (in -Wdefault)]
y :: Int (bound at T14590.hs:4:6)
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)
+ Valid hole fits include
+ f1 :: Int -> Int -> Int (bound at T14590.hs:4:1)
+ f2 :: Int -> Int -> Int (bound at T14590.hs:5:1)
+ f3 :: Int -> Int -> Int (bound at T14590.hs:6:1)
+ f4 :: Int -> Int -> Int (bound at T14590.hs:7:1)
+ seq :: forall a b. a -> b -> b
+ with seq @Int @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Prim’))
+ (-) :: forall a. Num a => a -> a -> a
+ with (-) @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Num’))
+ asTypeOf :: forall a. a -> a -> a
+ with asTypeOf @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Base’))
+ const :: forall a b. a -> b -> a
+ with const @Int @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Base’))
+ subtract :: forall a. Num a => a -> a -> a
+ with subtract @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Num’))
+ (^) :: forall a b. (Num a, Integral b) => a -> b -> a
+ with (^) @Int @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
gcd :: forall a. Integral a => a -> a -> a
+ with gcd @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Real’))
lcm :: forall a. Integral a => a -> a -> a
+ with lcm @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Real’))
+ (*) :: forall a. Num a => a -> a -> a
+ with (*) @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Num’))
+ (+) :: forall a. Num a => a -> a -> a
+ with (+) @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Num’))
div :: forall a. Integral a => a -> a -> a
+ with div @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Real’))
mod :: forall a. Integral a => a -> a -> a
+ with mod @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Real’))
quot :: forall a. Integral a => a -> a -> a
+ with quot @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Real’))
rem :: forall a. Integral a => a -> a -> a
+ with rem @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Real’))
max :: forall a. Ord a => a -> a -> a
+ with max @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Classes’))
min :: forall a. Ord a => a -> a -> a
+ with min @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Classes’))
- (^) :: forall a b. (Num a, Integral b) => a -> b -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Real’))
- (-) :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Num’))
- subtract :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Num’))
- (*) :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Num’))
- (+) :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Num’))
- asTypeOf :: forall a. a -> a -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Base’))
- const :: forall a b. a -> b -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Base’))
return :: forall (m :: * -> *). Monad m => forall a. a -> m a
+ with return @((->) Int) @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Base’))
pure :: forall (f :: * -> *). Applicative f => forall a. a -> f a
+ with pure @((->) Int) @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Base’))
- seq :: forall a b. a -> b -> b
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Prim’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Err’))
T14590.hs:5:13: warning: [-Wtyped-holes (in -Wdefault)]
• Found hole: _a :: Int -> Int -> Int
@@ -81,68 +96,83 @@ T14590.hs:5:13: warning: [-Wtyped-holes (in -Wdefault)]
y :: Int (bound at T14590.hs:5:6)
x :: Int (bound at T14590.hs:5:4)
f2 :: Int -> Int -> Int (bound at T14590.hs:5:1)
- Valid substitutions include
+ Valid hole fits include
+ f2 :: Int -> Int -> Int (bound at T14590.hs:5:1)
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)
+ f3 :: Int -> Int -> Int (bound at T14590.hs:6:1)
+ f4 :: Int -> Int -> Int (bound at T14590.hs:7:1)
+ seq :: forall a b. a -> b -> b
+ with seq @Int @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Prim’))
+ (-) :: forall a. Num a => a -> a -> a
+ with (-) @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Num’))
+ asTypeOf :: forall a. a -> a -> a
+ with asTypeOf @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Base’))
+ const :: forall a b. a -> b -> a
+ with const @Int @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Base’))
+ subtract :: forall a. Num a => a -> a -> a
+ with subtract @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Num’))
+ (^) :: forall a b. (Num a, Integral b) => a -> b -> a
+ with (^) @Int @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
gcd :: forall a. Integral a => a -> a -> a
+ with gcd @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Real’))
lcm :: forall a. Integral a => a -> a -> a
+ with lcm @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Real’))
+ (*) :: forall a. Num a => a -> a -> a
+ with (*) @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Num’))
+ (+) :: forall a. Num a => a -> a -> a
+ with (+) @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Num’))
div :: forall a. Integral a => a -> a -> a
+ with div @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Real’))
mod :: forall a. Integral a => a -> a -> a
+ with mod @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Real’))
quot :: forall a. Integral a => a -> a -> a
+ with quot @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Real’))
rem :: forall a. Integral a => a -> a -> a
+ with rem @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Real’))
max :: forall a. Ord a => a -> a -> a
+ with max @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Classes’))
min :: forall a. Ord a => a -> a -> a
+ with min @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Classes’))
- (^) :: forall a b. (Num a, Integral b) => a -> b -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Real’))
- (-) :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Num’))
- subtract :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Num’))
- (*) :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Num’))
- (+) :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Num’))
- asTypeOf :: forall a. a -> a -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Base’))
- const :: forall a b. a -> b -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Base’))
return :: forall (m :: * -> *). Monad m => forall a. a -> m a
+ with return @((->) Int) @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Base’))
pure :: forall (f :: * -> *). Applicative f => forall a. a -> f a
+ with pure @((->) Int) @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Base’))
- seq :: forall a b. a -> b -> b
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Prim’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Err’))
T14590.hs:6:11: warning: [-Wtyped-holes (in -Wdefault)]
• Found hole: _ :: Int -> Int -> Int
@@ -153,68 +183,83 @@ T14590.hs:6:11: warning: [-Wtyped-holes (in -Wdefault)]
y :: Int (bound at T14590.hs:6:6)
x :: Int (bound at T14590.hs:6:4)
f3 :: Int -> Int -> Int (bound at T14590.hs:6:1)
- Valid substitutions include
+ Valid hole fits include
+ f3 :: Int -> Int -> Int (bound at T14590.hs:6:1)
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)
+ f4 :: Int -> Int -> Int (bound at T14590.hs:7:1)
+ seq :: forall a b. a -> b -> b
+ with seq @Int @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Prim’))
+ (-) :: forall a. Num a => a -> a -> a
+ with (-) @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Num’))
+ asTypeOf :: forall a. a -> a -> a
+ with asTypeOf @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Base’))
+ const :: forall a b. a -> b -> a
+ with const @Int @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Base’))
+ subtract :: forall a. Num a => a -> a -> a
+ with subtract @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Num’))
+ (^) :: forall a b. (Num a, Integral b) => a -> b -> a
+ with (^) @Int @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
gcd :: forall a. Integral a => a -> a -> a
+ with gcd @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Real’))
lcm :: forall a. Integral a => a -> a -> a
+ with lcm @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Real’))
+ (*) :: forall a. Num a => a -> a -> a
+ with (*) @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Num’))
+ (+) :: forall a. Num a => a -> a -> a
+ with (+) @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Num’))
div :: forall a. Integral a => a -> a -> a
+ with div @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Real’))
mod :: forall a. Integral a => a -> a -> a
+ with mod @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Real’))
quot :: forall a. Integral a => a -> a -> a
+ with quot @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Real’))
rem :: forall a. Integral a => a -> a -> a
+ with rem @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Real’))
max :: forall a. Ord a => a -> a -> a
+ with max @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Classes’))
min :: forall a. Ord a => a -> a -> a
+ with min @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Classes’))
- (^) :: forall a b. (Num a, Integral b) => a -> b -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Real’))
- (-) :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Num’))
- subtract :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Num’))
- (*) :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Num’))
- (+) :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Num’))
- asTypeOf :: forall a. a -> a -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Base’))
- const :: forall a b. a -> b -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Base’))
return :: forall (m :: * -> *). Monad m => forall a. a -> m a
+ with return @((->) Int) @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Base’))
pure :: forall (f :: * -> *). Applicative f => forall a. a -> f a
+ with pure @((->) Int) @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Base’))
- seq :: forall a b. a -> b -> b
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Prim’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Err’))
T14590.hs:7:11: warning: [-Wtyped-holes (in -Wdefault)]
• Found hole: _a :: Int -> Int -> Int
@@ -226,65 +271,80 @@ T14590.hs:7:11: warning: [-Wtyped-holes (in -Wdefault)]
y :: Int (bound at T14590.hs:7:6)
x :: Int (bound at T14590.hs:7:4)
f4 :: Int -> Int -> Int (bound at T14590.hs:7:1)
- Valid substitutions include
+ Valid hole fits include
+ f4 :: Int -> Int -> Int (bound at T14590.hs:7:1)
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)
+ seq :: forall a b. a -> b -> b
+ with seq @Int @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Prim’))
+ (-) :: forall a. Num a => a -> a -> a
+ with (-) @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Num’))
+ asTypeOf :: forall a. a -> a -> a
+ with asTypeOf @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Base’))
+ const :: forall a b. a -> b -> a
+ with const @Int @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Base’))
+ subtract :: forall a. Num a => a -> a -> a
+ with subtract @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Num’))
+ (^) :: forall a b. (Num a, Integral b) => a -> b -> a
+ with (^) @Int @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Real’))
gcd :: forall a. Integral a => a -> a -> a
+ with gcd @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Real’))
lcm :: forall a. Integral a => a -> a -> a
+ with lcm @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Real’))
+ (*) :: forall a. Num a => a -> a -> a
+ with (*) @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Num’))
+ (+) :: forall a. Num a => a -> a -> a
+ with (+) @Int
+ (imported from ‘Prelude’ at T14590.hs:1:8-13
+ (and originally defined in ‘GHC.Num’))
div :: forall a. Integral a => a -> a -> a
+ with div @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Real’))
mod :: forall a. Integral a => a -> a -> a
+ with mod @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Real’))
quot :: forall a. Integral a => a -> a -> a
+ with quot @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Real’))
rem :: forall a. Integral a => a -> a -> a
+ with rem @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Real’))
max :: forall a. Ord a => a -> a -> a
+ with max @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Classes’))
min :: forall a. Ord a => a -> a -> a
+ with min @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Classes’))
- (^) :: forall a b. (Num a, Integral b) => a -> b -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Real’))
- (-) :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Num’))
- subtract :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Num’))
- (*) :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Num’))
- (+) :: forall a. Num a => a -> a -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Num’))
- asTypeOf :: forall a. a -> a -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Base’))
- const :: forall a b. a -> b -> a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Base’))
return :: forall (m :: * -> *). Monad m => forall a. a -> m a
+ with return @((->) Int) @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Base’))
pure :: forall (f :: * -> *). Applicative f => forall a. a -> f a
+ with pure @((->) Int) @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Base’))
- seq :: forall a b. a -> b -> b
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Prim’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at T14590.hs:1:8-13
- (and originally defined in ‘GHC.Err’))
diff --git a/testsuite/tests/typecheck/should_compile/T9497a.stderr b/testsuite/tests/typecheck/should_compile/T9497a.stderr
index b095e5a3f1..d24849df79 100644
--- a/testsuite/tests/typecheck/should_compile/T9497a.stderr
+++ b/testsuite/tests/typecheck/should_compile/T9497a.stderr
@@ -5,14 +5,13 @@ T9497a.hs:2:8: warning: [-Wtyped-holes (in -Wdefault)]
• In the expression: _main
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)
+ Valid hole fits include
+ main :: IO () (bound at T9497a.hs:2:1)
readLn :: forall a. Read a => IO a
+ with readLn @()
(imported from ‘Prelude’ at T9497a.hs:1:1
(and originally defined in ‘System.IO’))
mempty :: forall a. Monoid a => a
+ with mempty @(IO ())
(imported from ‘Prelude’ at T9497a.hs:1:1
(and originally defined in ‘GHC.Base’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at T9497a.hs:1:1
- (and originally defined in ‘GHC.Err’))
diff --git a/testsuite/tests/typecheck/should_compile/ValidHoleFits.hs b/testsuite/tests/typecheck/should_compile/ValidHoleFits.hs
new file mode 100644
index 0000000000..c996d109fa
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/ValidHoleFits.hs
@@ -0,0 +1,4 @@
+module ValidHoleFits where
+
+
+data Moo = Moo Integer
diff --git a/testsuite/tests/typecheck/should_compile/ValidSubs.hs b/testsuite/tests/typecheck/should_compile/ValidSubs.hs
deleted file mode 100644
index 050b317d9d..0000000000
--- a/testsuite/tests/typecheck/should_compile/ValidSubs.hs
+++ /dev/null
@@ -1,4 +0,0 @@
-module ValidSubs where
-
-
-data Moo = Moo Integer
diff --git a/testsuite/tests/typecheck/should_compile/abstract_refinement_substitutions.hs b/testsuite/tests/typecheck/should_compile/abstract_refinement_hole_fits.hs
index 4949632308..4949632308 100644
--- a/testsuite/tests/typecheck/should_compile/abstract_refinement_substitutions.hs
+++ b/testsuite/tests/typecheck/should_compile/abstract_refinement_hole_fits.hs
diff --git a/testsuite/tests/typecheck/should_compile/abstract_refinement_hole_fits.stderr b/testsuite/tests/typecheck/should_compile/abstract_refinement_hole_fits.stderr
new file mode 100644
index 0000000000..3c2a30563a
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/abstract_refinement_hole_fits.stderr
@@ -0,0 +1,277 @@
+
+abstract_refinement_hole_fits.hs:4:5: warning: [-Wtyped-holes (in -Wdefault)]
+ • Found hole: _ :: [Integer] -> Integer
+ • In the expression: _
+ In an equation for ‘f’: f = _
+ • Relevant bindings include
+ f :: [Integer] -> Integer
+ (bound at abstract_refinement_hole_fits.hs:4:1)
+ Valid hole fits include
+ f :: [Integer] -> Integer
+ g :: [Integer] -> Integer
+ head :: forall a. [a] -> a
+ last :: forall a. [a] -> a
+ maximum :: forall (t :: * -> *).
+ Foldable t =>
+ forall a. Ord a => t a -> a
+ minimum :: forall (t :: * -> *).
+ Foldable t =>
+ forall a. Ord a => t a -> a
+ product :: forall (t :: * -> *).
+ Foldable t =>
+ forall a. Num a => t a -> a
+ sum :: forall (t :: * -> *).
+ Foldable t =>
+ forall a. Num a => t a -> a
+ Valid refinement hole fits include
+ foldl1 (_ :: Integer -> Integer -> Integer)
+ where foldl1 :: forall (t :: * -> *).
+ Foldable t =>
+ forall a. (a -> a -> a) -> t a -> a
+ foldr1 (_ :: Integer -> Integer -> Integer)
+ where foldr1 :: forall (t :: * -> *).
+ Foldable t =>
+ forall a. (a -> a -> a) -> t a -> a
+ foldl (_ :: Integer -> Integer -> Integer) (_ :: Integer)
+ where foldl :: forall (t :: * -> *).
+ Foldable t =>
+ forall b a. (b -> a -> b) -> b -> t a -> b
+ foldr (_ :: Integer -> Integer -> Integer) (_ :: Integer)
+ where foldr :: forall (t :: * -> *).
+ Foldable t =>
+ forall a b. (a -> b -> b) -> b -> t a -> b
+ const (_ :: Integer)
+ where const :: forall a b. a -> b -> a
+ ($) (_ :: [Integer] -> Integer)
+ where ($) :: forall a b. (a -> b) -> a -> b
+ fail (_ :: String)
+ where fail :: forall (m :: * -> *).
+ Monad m =>
+ forall a. String -> m a
+ return (_ :: Integer)
+ where return :: forall (m :: * -> *). Monad m => forall a. a -> m a
+ pure (_ :: Integer)
+ where pure :: forall (f :: * -> *).
+ Applicative f =>
+ forall a. a -> f a
+ ($!) (_ :: [Integer] -> Integer)
+ where ($!) :: forall a b. (a -> b) -> a -> b
+ curry (_ :: (a2, [Integer]) -> Integer) (_ :: a2)
+ where curry :: forall a b c. ((a, b) -> c) -> a -> b -> c
+ (.) (_ :: b1 -> Integer) (_ :: [Integer] -> b1)
+ where (.) :: forall b c a. (b -> c) -> (a -> b) -> a -> c
+ flip (_ :: [Integer] -> b7 -> Integer) (_ :: b7)
+ where flip :: forall a b c. (a -> b -> c) -> b -> a -> c
+ (>>=) (_ :: [Integer] -> a11) (_ :: a11 -> [Integer] -> Integer)
+ where (>>=) :: forall (m :: * -> *).
+ Monad m =>
+ forall a b. m a -> (a -> m b) -> m b
+ (>>) (_ :: [Integer] -> a10) (_ :: [Integer] -> Integer)
+ where (>>) :: forall (m :: * -> *).
+ Monad m =>
+ forall a b. m a -> m b -> m b
+ fmap (_ :: a12 -> Integer) (_ :: [Integer] -> a12)
+ where fmap :: forall (f :: * -> *).
+ Functor f =>
+ forall a b. (a -> b) -> f a -> f b
+ (<*>) (_ :: [Integer] -> a8 -> Integer) (_ :: [Integer] -> a8)
+ where (<*>) :: forall (f :: * -> *).
+ Applicative f =>
+ forall a b. f (a -> b) -> f a -> f b
+ (*>) (_ :: [Integer] -> a7) (_ :: [Integer] -> Integer)
+ where (*>) :: forall (f :: * -> *).
+ Applicative f =>
+ forall a b. f a -> f b -> f b
+ (<$>) (_ :: a1 -> Integer) (_ :: [Integer] -> a1)
+ where (<$>) :: forall (f :: * -> *) a b.
+ Functor f =>
+ (a -> b) -> f a -> f b
+ (=<<) (_ :: a9 -> [Integer] -> Integer) (_ :: [Integer] -> a9)
+ where (=<<) :: forall (m :: * -> *) a b.
+ Monad m =>
+ (a -> m b) -> m a -> m b
+ (<*) (_ :: [Integer] -> Integer) (_ :: [Integer] -> b5)
+ where (<*) :: forall (f :: * -> *).
+ Applicative f =>
+ forall a b. f a -> f b -> f a
+ (<$) (_ :: Integer) (_ :: [Integer] -> b4)
+ where (<$) :: forall (f :: * -> *).
+ Functor f =>
+ forall a b. a -> f b -> f a
+ id (_ :: t0 -> [Integer] -> Integer) (_ :: t0)
+ where id :: forall a. a -> a
+ head (_ :: [t0 -> [Integer] -> Integer]) (_ :: t0)
+ where head :: forall a. [a] -> a
+ last (_ :: [t0 -> [Integer] -> Integer]) (_ :: t0)
+ where last :: forall a. [a] -> a
+ fst (_ :: (t0 -> [Integer] -> Integer, b2)) (_ :: t0)
+ where fst :: forall a b. (a, b) -> a
+ snd (_ :: (a3, t0 -> [Integer] -> Integer)) (_ :: t0)
+ where snd :: forall a b. (a, b) -> b
+ id (_ :: [Integer] -> Integer)
+ where id :: forall a. a -> a
+ head (_ :: [[Integer] -> Integer])
+ where head :: forall a. [a] -> a
+ last (_ :: [[Integer] -> Integer])
+ where last :: forall a. [a] -> a
+ asTypeOf (_ :: [Integer] -> Integer) (_ :: [Integer] -> Integer)
+ where asTypeOf :: forall a. a -> a -> a
+ (!!) (_ :: [[Integer] -> Integer]) (_ :: Int)
+ where (!!) :: forall a. [a] -> Int -> a
+ fst (_ :: ([Integer] -> Integer, b0))
+ where fst :: forall a b. (a, b) -> a
+ snd (_ :: (a0, [Integer] -> Integer))
+ where snd :: forall a b. (a, b) -> b
+ seq (_ :: a13) (_ :: [Integer] -> Integer)
+ where seq :: forall a b. a -> b -> b
+ const (_ :: [Integer] -> Integer) (_ :: b6)
+ where const :: forall a b. a -> b -> a
+ ($) (_ :: a5 -> [Integer] -> Integer) (_ :: a5)
+ where ($) :: forall a b. (a -> b) -> a -> b
+ fail (_ :: String) (_ :: t0)
+ where fail :: forall (m :: * -> *).
+ Monad m =>
+ forall a. String -> m a
+ return (_ :: [Integer] -> Integer) (_ :: t0)
+ where return :: forall (m :: * -> *). Monad m => forall a. a -> m a
+ pure (_ :: [Integer] -> Integer) (_ :: t0)
+ where pure :: forall (f :: * -> *).
+ Applicative f =>
+ forall a. a -> f a
+ uncurry (_ :: a4 -> b3 -> [Integer] -> Integer) (_ :: (a4, b3))
+ where uncurry :: forall a b c. (a -> b -> c) -> (a, b) -> c
+ ($!) (_ :: a6 -> [Integer] -> Integer) (_ :: a6)
+ where ($!) :: forall a b. (a -> b) -> a -> b
+
+abstract_refinement_hole_fits.hs:7:5: warning: [-Wtyped-holes (in -Wdefault)]
+ • Found hole: _ :: Integer -> [Integer] -> Integer
+ • In the expression: _
+ In the expression: _ 0
+ In an equation for ‘g’: g = _ 0
+ • Relevant bindings include
+ g :: [Integer] -> Integer
+ (bound at abstract_refinement_hole_fits.hs:7:1)
+ Valid hole fits include
+ const :: forall a b. a -> b -> a
+ return :: forall (m :: * -> *). Monad m => forall a. a -> m a
+ pure :: forall (f :: * -> *). Applicative f => forall a. a -> f a
+ Valid refinement hole fits include
+ foldl (_ :: Integer -> Integer -> Integer)
+ where foldl :: forall (t :: * -> *).
+ Foldable t =>
+ forall b a. (b -> a -> b) -> b -> t a -> b
+ foldr (_ :: Integer -> Integer -> Integer)
+ where foldr :: forall (t :: * -> *).
+ Foldable t =>
+ forall a b. (a -> b -> b) -> b -> t a -> b
+ curry (_ :: (Integer, [Integer]) -> Integer)
+ where curry :: forall a b c. ((a, b) -> c) -> a -> b -> c
+ flip (_ :: [Integer] -> Integer -> Integer)
+ where flip :: forall a b c. (a -> b -> c) -> b -> a -> c
+ const (_ :: [Integer] -> Integer)
+ where const :: forall a b. a -> b -> a
+ ($) (_ :: Integer -> [Integer] -> Integer)
+ where ($) :: forall a b. (a -> b) -> a -> b
+ fail (_ :: String)
+ where fail :: forall (m :: * -> *).
+ Monad m =>
+ forall a. String -> m a
+ return (_ :: [Integer] -> Integer)
+ where return :: forall (m :: * -> *). Monad m => forall a. a -> m a
+ pure (_ :: [Integer] -> Integer)
+ where pure :: forall (f :: * -> *).
+ Applicative f =>
+ forall a. a -> f a
+ ($!) (_ :: Integer -> [Integer] -> Integer)
+ where ($!) :: forall a b. (a -> b) -> a -> b
+ curry (_ :: (a2, Integer) -> [Integer] -> Integer) (_ :: a2)
+ where curry :: forall a b c. ((a, b) -> c) -> a -> b -> c
+ (.) (_ :: b1 -> [Integer] -> Integer) (_ :: Integer -> b1)
+ where (.) :: forall b c a. (b -> c) -> (a -> b) -> a -> c
+ flip (_ :: Integer -> b7 -> [Integer] -> Integer) (_ :: b7)
+ where flip :: forall a b c. (a -> b -> c) -> b -> a -> c
+ (>>=) (_ :: Integer -> a11)
+ (_ :: a11 -> Integer -> [Integer] -> Integer)
+ where (>>=) :: forall (m :: * -> *).
+ Monad m =>
+ forall a b. m a -> (a -> m b) -> m b
+ (>>) (_ :: Integer -> a10) (_ :: Integer -> [Integer] -> Integer)
+ where (>>) :: forall (m :: * -> *).
+ Monad m =>
+ forall a b. m a -> m b -> m b
+ fmap (_ :: a12 -> [Integer] -> Integer) (_ :: Integer -> a12)
+ where fmap :: forall (f :: * -> *).
+ Functor f =>
+ forall a b. (a -> b) -> f a -> f b
+ (<*>) (_ :: Integer -> a8 -> [Integer] -> Integer)
+ (_ :: Integer -> a8)
+ where (<*>) :: forall (f :: * -> *).
+ Applicative f =>
+ forall a b. f (a -> b) -> f a -> f b
+ (*>) (_ :: Integer -> a7) (_ :: Integer -> [Integer] -> Integer)
+ where (*>) :: forall (f :: * -> *).
+ Applicative f =>
+ forall a b. f a -> f b -> f b
+ (<$>) (_ :: a1 -> [Integer] -> Integer) (_ :: Integer -> a1)
+ where (<$>) :: forall (f :: * -> *) a b.
+ Functor f =>
+ (a -> b) -> f a -> f b
+ (=<<) (_ :: a9 -> Integer -> [Integer] -> Integer)
+ (_ :: Integer -> a9)
+ where (=<<) :: forall (m :: * -> *) a b.
+ Monad m =>
+ (a -> m b) -> m a -> m b
+ (<*) (_ :: Integer -> [Integer] -> Integer) (_ :: Integer -> b5)
+ where (<*) :: forall (f :: * -> *).
+ Applicative f =>
+ forall a b. f a -> f b -> f a
+ (<$) (_ :: [Integer] -> Integer) (_ :: Integer -> b4)
+ where (<$) :: forall (f :: * -> *).
+ Functor f =>
+ forall a b. a -> f b -> f a
+ id (_ :: t0 -> Integer -> [Integer] -> Integer) (_ :: t0)
+ where id :: forall a. a -> a
+ head (_ :: [t0 -> Integer -> [Integer] -> Integer]) (_ :: t0)
+ where head :: forall a. [a] -> a
+ last (_ :: [t0 -> Integer -> [Integer] -> Integer]) (_ :: t0)
+ where last :: forall a. [a] -> a
+ fst (_ :: (t0 -> Integer -> [Integer] -> Integer, b2)) (_ :: t0)
+ where fst :: forall a b. (a, b) -> a
+ snd (_ :: (a3, t0 -> Integer -> [Integer] -> Integer)) (_ :: t0)
+ where snd :: forall a b. (a, b) -> b
+ id (_ :: Integer -> [Integer] -> Integer)
+ where id :: forall a. a -> a
+ head (_ :: [Integer -> [Integer] -> Integer])
+ where head :: forall a. [a] -> a
+ last (_ :: [Integer -> [Integer] -> Integer])
+ where last :: forall a. [a] -> a
+ asTypeOf (_ :: Integer -> [Integer] -> Integer)
+ (_ :: Integer -> [Integer] -> Integer)
+ where asTypeOf :: forall a. a -> a -> a
+ (!!) (_ :: [Integer -> [Integer] -> Integer]) (_ :: Int)
+ where (!!) :: forall a. [a] -> Int -> a
+ fst (_ :: (Integer -> [Integer] -> Integer, b0))
+ where fst :: forall a b. (a, b) -> a
+ snd (_ :: (a0, Integer -> [Integer] -> Integer))
+ where snd :: forall a b. (a, b) -> b
+ seq (_ :: a13) (_ :: Integer -> [Integer] -> Integer)
+ where seq :: forall a b. a -> b -> b
+ const (_ :: Integer -> [Integer] -> Integer) (_ :: b6)
+ where const :: forall a b. a -> b -> a
+ ($) (_ :: a5 -> Integer -> [Integer] -> Integer) (_ :: a5)
+ where ($) :: forall a b. (a -> b) -> a -> b
+ fail (_ :: String) (_ :: t0)
+ where fail :: forall (m :: * -> *).
+ Monad m =>
+ forall a. String -> m a
+ return (_ :: Integer -> [Integer] -> Integer) (_ :: t0)
+ where return :: forall (m :: * -> *). Monad m => forall a. a -> m a
+ pure (_ :: Integer -> [Integer] -> Integer) (_ :: t0)
+ where pure :: forall (f :: * -> *).
+ Applicative f =>
+ forall a. a -> f a
+ uncurry (_ :: a4 -> b3 -> Integer -> [Integer] -> Integer)
+ (_ :: (a4, b3))
+ where uncurry :: forall a b c. (a -> b -> c) -> (a, b) -> c
+ ($!) (_ :: a6 -> Integer -> [Integer] -> Integer) (_ :: a6)
+ where ($!) :: forall a b. (a -> b) -> a -> b
diff --git a/testsuite/tests/typecheck/should_compile/abstract_refinement_substitutions.stderr b/testsuite/tests/typecheck/should_compile/abstract_refinement_substitutions.stderr
deleted file mode 100644
index 21398bb3fb..0000000000
--- a/testsuite/tests/typecheck/should_compile/abstract_refinement_substitutions.stderr
+++ /dev/null
@@ -1,410 +0,0 @@
-
-abstract_refinement_substitutions.hs:4:5: warning: [-Wtyped-holes (in -Wdefault)]
- • Found hole: _ :: [Integer] -> Integer
- • In the expression: _
- In an equation for ‘f’: f = _
- • Relevant bindings include
- f :: [Integer] -> Integer
- (bound at abstract_refinement_substitutions.hs:4:1)
- Valid substitutions include
- f :: [Integer] -> Integer
- (defined at abstract_refinement_substitutions.hs:4:1)
- g :: [Integer] -> Integer
- (defined at abstract_refinement_substitutions.hs:7:1)
- product :: forall (t :: * -> *).
- Foldable t =>
- forall a. Num a => t a -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘Data.Foldable’))
- sum :: forall (t :: * -> *).
- Foldable t =>
- forall a. Num a => t a -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘Data.Foldable’))
- maximum :: forall (t :: * -> *).
- Foldable t =>
- forall a. Ord a => t a -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘Data.Foldable’))
- minimum :: forall (t :: * -> *).
- Foldable t =>
- forall a. Ord a => t a -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘Data.Foldable’))
- head :: forall a. [a] -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.List’))
- last :: forall a. [a] -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.List’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Err’))
- Valid refinement substitutions include
- (<$) _ _ :: forall (f :: * -> *).
- Functor f =>
- forall a b. a -> f b -> f a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- (<*) _ _ :: forall (f :: * -> *).
- Applicative f =>
- forall a b. f a -> f b -> f a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- foldr _ _ :: forall (t :: * -> *).
- Foldable t =>
- forall a b. (a -> b -> b) -> b -> t a -> b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘Data.Foldable’))
- foldl1 _ :: forall (t :: * -> *).
- Foldable t =>
- forall a. (a -> a -> a) -> t a -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘Data.Foldable’))
- foldr1 _ :: forall (t :: * -> *).
- Foldable t =>
- forall a. (a -> a -> a) -> t a -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘Data.Foldable’))
- foldl _ _ :: forall (t :: * -> *).
- Foldable t =>
- forall b a. (b -> a -> b) -> b -> t a -> b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘Data.Foldable’))
- last _ _ :: forall a. [a] -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.List’))
- head _ :: forall a. [a] -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.List’))
- head _ _ :: forall a. [a] -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.List’))
- last _ :: forall a. [a] -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.List’))
- (!!) _ _ :: forall a. [a] -> Int -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.List’))
- undefined _ :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Err’))
- errorWithoutStackTrace _ :: forall a. [Char] -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Err’))
- error _ _ :: forall a. GHC.Stack.Types.HasCallStack => [Char] -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Err’))
- id _ :: forall a. a -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- flip _ _ :: forall a b c. (a -> b -> c) -> b -> a -> c
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- const _ :: forall a b. a -> b -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- asTypeOf _ _ :: forall a. a -> a -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- const _ _ :: forall a b. a -> b -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- (=<<) _ _ :: forall (m :: * -> *) a b.
- Monad m =>
- (a -> m b) -> m a -> m b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- (.) _ _ :: forall b c a. (b -> c) -> (a -> b) -> a -> c
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- ($!) _ :: forall a b. (a -> b) -> a -> b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- uncurry _ _ :: forall a b c. (a -> b -> c) -> (a, b) -> c
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘Data.Tuple’))
- curry _ _ :: forall a b c. ((a, b) -> c) -> a -> b -> c
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘Data.Tuple’))
- pure _ :: forall (f :: * -> *). Applicative f => forall a. a -> f a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- (<*>) _ _ :: forall (f :: * -> *).
- Applicative f =>
- forall a b. f (a -> b) -> f a -> f b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- return _ :: forall (m :: * -> *). Monad m => forall a. a -> m a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- return _ _ :: forall (m :: * -> *). Monad m => forall a. a -> m a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- pure _ _ :: forall (f :: * -> *).
- Applicative f =>
- forall a. a -> f a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- fmap _ _ :: forall (f :: * -> *).
- Functor f =>
- forall a b. (a -> b) -> f a -> f b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- (<$>) _ _ :: forall (f :: * -> *) a b.
- Functor f =>
- (a -> b) -> f a -> f b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘Data.Functor’))
- (>>) _ _ :: forall (m :: * -> *).
- Monad m =>
- forall a b. m a -> m b -> m b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- (*>) _ _ :: forall (f :: * -> *).
- Applicative f =>
- forall a b. f a -> f b -> f b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- (>>=) _ _ :: forall (m :: * -> *).
- Monad m =>
- forall a b. m a -> (a -> m b) -> m b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- fail _ _ :: forall (m :: * -> *).
- Monad m =>
- forall a. String -> m a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- fail _ :: forall (m :: * -> *). Monad m => forall a. String -> m a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- error _ :: forall a. GHC.Stack.Types.HasCallStack => [Char] -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Err’))
- errorWithoutStackTrace _ _ :: forall a. [Char] -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Err’))
- ($) _ :: forall a b. (a -> b) -> a -> b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- ($) _ _ :: forall a b. (a -> b) -> a -> b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- ($!) _ _ :: forall a b. (a -> b) -> a -> b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- id _ _ :: forall a. a -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- snd _ :: forall a b. (a, b) -> b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘Data.Tuple’))
- snd _ _ :: forall a b. (a, b) -> b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘Data.Tuple’))
- fst _ _ :: forall a b. (a, b) -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘Data.Tuple’))
- fst _ :: forall a b. (a, b) -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘Data.Tuple’))
- seq _ _ :: forall a b. a -> b -> b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Prim’))
- undefined _ _ :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Err’))
-
-abstract_refinement_substitutions.hs:7:5: warning: [-Wtyped-holes (in -Wdefault)]
- • Found hole: _ :: Integer -> [Integer] -> Integer
- • In the expression: _
- In the expression: _ 0
- In an equation for ‘g’: g = _ 0
- • Relevant bindings include
- g :: [Integer] -> Integer
- (bound at abstract_refinement_substitutions.hs:7:1)
- Valid substitutions include
- const :: forall a b. a -> b -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- return :: forall (m :: * -> *). Monad m => forall a. a -> m a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- pure :: forall (f :: * -> *). Applicative f => forall a. a -> f a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Err’))
- Valid refinement substitutions include
- (<$) _ _ :: forall (f :: * -> *).
- Functor f =>
- forall a b. a -> f b -> f a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- (<*) _ _ :: forall (f :: * -> *).
- Applicative f =>
- forall a b. f a -> f b -> f a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- foldr _ :: forall (t :: * -> *).
- Foldable t =>
- forall a b. (a -> b -> b) -> b -> t a -> b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘Data.Foldable’))
- foldl _ :: forall (t :: * -> *).
- Foldable t =>
- forall b a. (b -> a -> b) -> b -> t a -> b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘Data.Foldable’))
- last _ :: forall a. [a] -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.List’))
- head _ _ :: forall a. [a] -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.List’))
- head _ :: forall a. [a] -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.List’))
- last _ _ :: forall a. [a] -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.List’))
- (!!) _ _ :: forall a. [a] -> Int -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.List’))
- undefined _ _ :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Err’))
- errorWithoutStackTrace _ :: forall a. [Char] -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Err’))
- error _ :: forall a. GHC.Stack.Types.HasCallStack => [Char] -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Err’))
- id _ _ :: forall a. a -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- flip _ :: forall a b c. (a -> b -> c) -> b -> a -> c
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- flip _ _ :: forall a b c. (a -> b -> c) -> b -> a -> c
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- const _ :: forall a b. a -> b -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- asTypeOf _ _ :: forall a. a -> a -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- const _ _ :: forall a b. a -> b -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- (=<<) _ _ :: forall (m :: * -> *) a b.
- Monad m =>
- (a -> m b) -> m a -> m b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- (.) _ _ :: forall b c a. (b -> c) -> (a -> b) -> a -> c
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- ($!) _ _ :: forall a b. (a -> b) -> a -> b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- uncurry _ _ :: forall a b c. (a -> b -> c) -> (a, b) -> c
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘Data.Tuple’))
- curry _ _ :: forall a b c. ((a, b) -> c) -> a -> b -> c
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘Data.Tuple’))
- curry _ :: forall a b c. ((a, b) -> c) -> a -> b -> c
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘Data.Tuple’))
- pure _ :: forall (f :: * -> *). Applicative f => forall a. a -> f a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- (<*>) _ _ :: forall (f :: * -> *).
- Applicative f =>
- forall a b. f (a -> b) -> f a -> f b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- return _ :: forall (m :: * -> *). Monad m => forall a. a -> m a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- return _ _ :: forall (m :: * -> *). Monad m => forall a. a -> m a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- pure _ _ :: forall (f :: * -> *).
- Applicative f =>
- forall a. a -> f a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- fmap _ _ :: forall (f :: * -> *).
- Functor f =>
- forall a b. (a -> b) -> f a -> f b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- (<$>) _ _ :: forall (f :: * -> *) a b.
- Functor f =>
- (a -> b) -> f a -> f b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘Data.Functor’))
- (>>) _ _ :: forall (m :: * -> *).
- Monad m =>
- forall a b. m a -> m b -> m b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- (*>) _ _ :: forall (f :: * -> *).
- Applicative f =>
- forall a b. f a -> f b -> f b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- (>>=) _ _ :: forall (m :: * -> *).
- Monad m =>
- forall a b. m a -> (a -> m b) -> m b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- fail _ _ :: forall (m :: * -> *).
- Monad m =>
- forall a. String -> m a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- fail _ :: forall (m :: * -> *). Monad m => forall a. String -> m a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- error _ _ :: forall a. GHC.Stack.Types.HasCallStack => [Char] -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Err’))
- errorWithoutStackTrace _ _ :: forall a. [Char] -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Err’))
- ($) _ :: forall a b. (a -> b) -> a -> b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- ($) _ _ :: forall a b. (a -> b) -> a -> b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- ($!) _ :: forall a b. (a -> b) -> a -> b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- id _ :: forall a. a -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Base’))
- snd _ :: forall a b. (a, b) -> b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘Data.Tuple’))
- snd _ _ :: forall a b. (a, b) -> b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘Data.Tuple’))
- fst _ _ :: forall a b. (a, b) -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘Data.Tuple’))
- fst _ :: forall a b. (a, b) -> a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘Data.Tuple’))
- seq _ _ :: forall a b. a -> b -> b
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Prim’))
- undefined _ :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at abstract_refinement_substitutions.hs:1:8-38
- (and originally defined in ‘GHC.Err’))
diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T
index 7ed58f5918..d130a69950 100644
--- a/testsuite/tests/typecheck/should_compile/all.T
+++ b/testsuite/tests/typecheck/should_compile/all.T
@@ -383,16 +383,21 @@ test('T7050', normal, compile, ['-O'])
test('T7312', normal, compile, [''])
test('T7384', normal, compile, [''])
test('T7451', normal, compile, [''])
-test('holes', normal, compile, ['-fdefer-type-errors -fno-max-valid-substitutions'])
-test('holes2', normal, compile, ['-fdefer-type-errors -fno-max-valid-substitutions'])
-test('holes3', normal, compile_fail, ['-fno-max-valid-substitutions'])
-test('hole_constraints', normal, compile, ['-fdefer-type-errors -fno-max-valid-substitutions'])
-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('refinement_substitutions', normal, compile, ['-fdefer-type-errors -fno-max-valid-substitutions -fno-max-refinement-substitutions -frefinement-level-substitutions=2'])
-test('abstract_refinement_substitutions', normal, compile, ['-fdefer-type-errors -fno-max-valid-substitutions -fno-max-refinement-substitutions -frefinement-level-substitutions=2 -fabstract-refinement-substitutions'])
+test('holes', normal, compile, ['-fdefer-type-errors -fno-max-valid-hole-fits -funclutter-valid-hole-fits'])
+test('holes2', normal, compile, ['-fdefer-type-errors -fno-max-valid-hole-fits -funclutter-valid-hole-fits'])
+test('holes3', normal, compile_fail, ['-fno-max-valid-hole-fits -funclutter-valid-hole-fits'])
+test('hole_constraints', normal, compile, ['-fdefer-type-errors -fno-max-valid-hole-fits -funclutter-valid-hole-fits'])
+test('hole_constraints_nested', normal, compile, ['-fdefer-type-errors -fno-max-valid-hole-fits -funclutter-valid-hole-fits'])
+test('valid_hole_fits', [extra_files(['ValidHoleFits.hs'])],
+ multimod_compile, ['valid_hole_fits','-fdefer-type-errors -fno-max-valid-hole-fits'])
+test('local_hole_fits', normal, compile, ['-fdefer-type-errors -fno-max-valid-hole-fits'])
+test('subsumption_sort_hole_fits', normal, compile, ['-fdefer-type-errors -fno-max-valid-hole-fits -fsort-by-subsumption-hole-fits'])
+test('valid_hole_fits_interactions', normal, compile, ['-fdefer-type-errors -fno-max-valid-hole-fits'])
+test('refinement_hole_fits', normal, compile, ['-fdefer-type-errors -fno-max-valid-hole-fits -fno-max-refinement-hole-fits -frefinement-level-hole-fits=2'])
+test('abstract_refinement_hole_fits', normal, compile, ['-fdefer-type-errors -fno-max-valid-hole-fits -fno-max-refinement-hole-fits -frefinement-level-hole-fits=2 -fabstract-refinement-hole-fits -funclutter-valid-hole-fits'])
+test('free_monad_hole_fits', normal, compile, ['-fdefer-type-errors -fno-max-valid-hole-fits -fno-max-refinement-hole-fits -frefinement-level-hole-fits=2 -funclutter-valid-hole-fits'])
+test('constraint_hole_fits', normal, compile, ['-fdefer-type-errors -fno-max-valid-hole-fits -fno-max-refinement-hole-fits -frefinement-level-hole-fits=2 -funclutter-valid-hole-fits'])
+test('type_in_type_hole_fits', normal, compile, ['-fdefer-type-errors -fno-max-valid-hole-fits'])
test('T7408', normal, compile, [''])
test('UnboxStrictPrimitiveFields', normal, compile, [''])
test('T7541', normal, compile, [''])
@@ -539,7 +544,7 @@ test('T12911', normal, compile, [''])
test('T12925', normal, compile, [''])
test('T12919', normal, compile, [''])
test('T12936', normal, compile, [''])
-test('T13050', normal, compile, ['-fdefer-type-errors -fno-max-valid-substitutions'])
+test('T13050', normal, compile, ['-fdefer-type-errors -fno-max-valid-hole-fits'])
test('T13083', normal, compile, [''])
test('T11723', normal, compile, [''])
test('T12987', normal, compile, [''])
@@ -591,13 +596,13 @@ test('T14434', [], run_command, ['$MAKE -s --no-print-directory T14434'])
test('MissingExportList01', normal, compile, [''])
test('MissingExportList02', normal, compile, [''])
test('T14488', normal, compile, [''])
-test('T14590', normal, compile, ['-fdefer-type-errors -fno-max-valid-substitutions'])
+test('T14590', normal, compile, ['-fdefer-type-errors -fno-max-valid-hole-fits'])
# We omit the hpc/profasm ways because this test checks the
# desugarer's output and these ways add some
# annotations/ticks that prevent it from giving the exact
# output we expect (T13032.stderr).
test('T13032', omit_ways(['hpc', 'profasm']), compile, [''])
-test('T14273', normal, compile, ['-fdefer-type-errors -fno-max-valid-substitutions'])
+test('T14273', normal, compile, ['-fdefer-type-errors -fno-max-valid-hole-fits'])
test('T14732', normal, compile, [''])
test('T14774', [], run_command, ['$MAKE -s --no-print-directory T14774'])
test('T14763', normal, compile, [''])
diff --git a/testsuite/tests/typecheck/should_compile/constraint_hole_fits.hs b/testsuite/tests/typecheck/should_compile/constraint_hole_fits.hs
new file mode 100644
index 0000000000..0cc46f4075
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/constraint_hole_fits.hs
@@ -0,0 +1,4 @@
+module ConstraintSubstitutions where
+
+g :: Ord a => [a] -> a
+g = _
diff --git a/testsuite/tests/typecheck/should_compile/constraint_hole_fits.stderr b/testsuite/tests/typecheck/should_compile/constraint_hole_fits.stderr
new file mode 100644
index 0000000000..bd23319b80
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/constraint_hole_fits.stderr
@@ -0,0 +1,65 @@
+
+constraint_hole_fits.hs:4:5: warning: [-Wtyped-holes (in -Wdefault)]
+ • Found hole: _ :: [a] -> a
+ Where: ‘a’ is a rigid type variable bound by
+ the type signature for:
+ g :: forall a. Ord a => [a] -> a
+ at constraint_hole_fits.hs:3:1-22
+ • In the expression: _
+ In an equation for ‘g’: g = _
+ • Relevant bindings include
+ g :: [a] -> a (bound at constraint_hole_fits.hs:4:1)
+ Constraints include Ord a (from constraint_hole_fits.hs:3:1-22)
+ Valid hole fits include
+ g :: [a] -> a
+ head :: forall a. [a] -> a
+ last :: forall a. [a] -> a
+ maximum :: forall (t :: * -> *).
+ Foldable t =>
+ forall a. Ord a => t a -> a
+ minimum :: forall (t :: * -> *).
+ Foldable t =>
+ forall a. Ord a => t a -> a
+ Valid refinement hole fits include
+ foldl1 (_ :: a -> a -> a)
+ where foldl1 :: forall (t :: * -> *).
+ Foldable t =>
+ forall a. (a -> a -> a) -> t a -> a
+ foldr1 (_ :: a -> a -> a)
+ where foldr1 :: forall (t :: * -> *).
+ Foldable t =>
+ forall a. (a -> a -> a) -> t a -> a
+ foldl (_ :: a -> a -> a) (_ :: a)
+ where foldl :: forall (t :: * -> *).
+ Foldable t =>
+ forall b a. (b -> a -> b) -> b -> t a -> b
+ foldr (_ :: a -> a -> a) (_ :: a)
+ where foldr :: forall (t :: * -> *).
+ Foldable t =>
+ forall a b. (a -> b -> b) -> b -> t a -> b
+ const (_ :: a)
+ where const :: forall a b. a -> b -> a
+ ($) (_ :: [a] -> a)
+ where ($) :: forall a b. (a -> b) -> a -> b
+ fail (_ :: String)
+ where fail :: forall (m :: * -> *).
+ Monad m =>
+ forall a. String -> m a
+ return (_ :: a)
+ where return :: forall (m :: * -> *). Monad m => forall a. a -> m a
+ pure (_ :: a)
+ where pure :: forall (f :: * -> *).
+ Applicative f =>
+ forall a. a -> f a
+ ($!) (_ :: [a] -> a)
+ where ($!) :: forall a b. (a -> b) -> a -> b
+ id (_ :: [a] -> a)
+ where id :: forall a. a -> a
+ head (_ :: [[a] -> a])
+ where head :: forall a. [a] -> a
+ last (_ :: [[a] -> a])
+ where last :: forall a. [a] -> a
+ asTypeOf (_ :: [a] -> a) (_ :: [a] -> a)
+ where asTypeOf :: forall a. a -> a -> a
+ (!!) (_ :: [[a] -> a]) (_ :: Int)
+ where (!!) :: forall a. [a] -> Int -> a
diff --git a/testsuite/tests/typecheck/should_compile/free_monad_hole_fits.hs b/testsuite/tests/typecheck/should_compile/free_monad_hole_fits.hs
new file mode 100644
index 0000000000..0fa5b77128
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/free_monad_hole_fits.hs
@@ -0,0 +1,25 @@
+{-# OPTIONS_GHC -frefinement-level-hole-fits=2 #-}
+{-# LANGUAGE MonoLocalBinds #-}
+module TG where
+import Prelude ( Monad, Applicative, Functor
+ , fmap, (<*>), pure, (>>=)
+ , (=<<), ($), (<$>) )
+
+data Free f a = Pure a | Free (f (Free f a))
+
+instance Functor f => Functor (Free f) where
+ fmap f = go where
+ go (Pure a) = Pure (f a)
+ -- Should suggest (fmap)
+ go (Free fa) = Free (_a go fa)
+
+instance Functor f => Applicative (Free f) where
+ pure = Pure
+ Pure a <*> Pure b = Pure (a b)
+ Pure a <*> Free mb = Free (fmap a <$> mb)
+ Free ma <*> b = Free ((<*> b) <$> ma)
+
+instance Applicative f => Monad (Free f) where
+ Pure a >>= f = f a
+ -- Should suggest ((=<< (_ :: a -> Free f b))
+ Free f >>= g = Free (fmap _a f)
diff --git a/testsuite/tests/typecheck/should_compile/free_monad_hole_fits.stderr b/testsuite/tests/typecheck/should_compile/free_monad_hole_fits.stderr
new file mode 100644
index 0000000000..f7acf41928
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/free_monad_hole_fits.stderr
@@ -0,0 +1,81 @@
+
+free_monad_hole_fits.hs:14:28: warning: [-Wtyped-holes (in -Wdefault)]
+ • Found hole:
+ _a :: (Free f a -> Free f b) -> f (Free f a) -> f (Free f b)
+ Where: ‘a’, ‘b’ are rigid type variables bound by
+ the type signature for:
+ fmap :: forall a b. (a -> b) -> Free f a -> Free f b
+ at free_monad_hole_fits.hs:11:5-8
+ ‘f’ is a rigid type variable bound by
+ the instance declaration
+ at free_monad_hole_fits.hs:10:10-38
+ Or perhaps ‘_a’ is mis-spelled, or not in scope
+ • In the expression: _a
+ In the first argument of ‘Free’, namely ‘(_a go fa)’
+ In the expression: Free (_a go fa)
+ • Relevant bindings include
+ fa :: f (Free f a) (bound at free_monad_hole_fits.hs:14:16)
+ go :: Free f a -> Free f b (bound at free_monad_hole_fits.hs:12:7)
+ f :: a -> b (bound at free_monad_hole_fits.hs:11:10)
+ fmap :: (a -> b) -> Free f a -> Free f b
+ (bound at free_monad_hole_fits.hs:11:5)
+ Constraints include
+ Functor f (from free_monad_hole_fits.hs:10:10-38)
+ Valid hole fits include
+ fmap :: forall (f :: * -> *).
+ Functor f =>
+ forall a b. (a -> b) -> f a -> f b
+ (<$>) :: forall (f :: * -> *) a b.
+ Functor f =>
+ (a -> b) -> f a -> f b
+ Valid refinement hole fits include
+ ($) (_ :: (Free f a -> Free f b) -> f (Free f a) -> f (Free f b))
+ where ($) :: forall a b. (a -> b) -> a -> b
+ pure (_ :: f (Free f a) -> f (Free f b))
+ where pure :: forall (f :: * -> *).
+ Applicative f =>
+ forall a. a -> f a
+
+free_monad_hole_fits.hs:25:31: warning: [-Wtyped-holes (in -Wdefault)]
+ • Found hole: _a :: Free f a -> Free f b
+ Where: ‘a’, ‘b’ are rigid type variables bound by
+ the type signature for:
+ (>>=) :: forall a b. Free f a -> (a -> Free f b) -> Free f b
+ at free_monad_hole_fits.hs:23:12-14
+ ‘f’ is a rigid type variable bound by
+ the instance declaration
+ at free_monad_hole_fits.hs:22:10-40
+ Or perhaps ‘_a’ is mis-spelled, or not in scope
+ • In the first argument of ‘fmap’, namely ‘_a’
+ In the first argument of ‘Free’, namely ‘(fmap _a f)’
+ In the expression: Free (fmap _a f)
+ • Relevant bindings include
+ g :: a -> Free f b (bound at free_monad_hole_fits.hs:25:16)
+ f :: f (Free f a) (bound at free_monad_hole_fits.hs:25:10)
+ (>>=) :: Free f a -> (a -> Free f b) -> Free f b
+ (bound at free_monad_hole_fits.hs:23:12)
+ Constraints include
+ Applicative f (from free_monad_hole_fits.hs:22:10-40)
+ Valid refinement hole fits include
+ fmap (_ :: a -> b)
+ where fmap :: forall (f :: * -> *).
+ Functor f =>
+ forall a b. (a -> b) -> f a -> f b
+ (<*>) (_ :: Free f (a -> b))
+ where (<*>) :: forall (f :: * -> *).
+ Applicative f =>
+ forall a b. f (a -> b) -> f a -> f b
+ (<$>) (_ :: a -> b)
+ where (<$>) :: forall (f :: * -> *) a b.
+ Functor f =>
+ (a -> b) -> f a -> f b
+ (=<<) (_ :: a -> Free f b)
+ where (=<<) :: forall (m :: * -> *) a b.
+ Monad m =>
+ (a -> m b) -> m a -> m b
+ ($) (_ :: Free f a -> Free f b)
+ where ($) :: forall a b. (a -> b) -> a -> b
+ pure (_ :: Free f b)
+ where pure :: forall (f :: * -> *).
+ Applicative f =>
+ forall a. a -> f a
diff --git a/testsuite/tests/typecheck/should_compile/hole_constraints.stderr b/testsuite/tests/typecheck/should_compile/hole_constraints.stderr
index 53f32cf8c9..82cc6262bd 100644
--- a/testsuite/tests/typecheck/should_compile/hole_constraints.stderr
+++ b/testsuite/tests/typecheck/should_compile/hole_constraints.stderr
@@ -10,11 +10,7 @@ hole_constraints.hs:8:6: warning: [-Wtyped-holes (in -Wdefault)]
• Relevant bindings include
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. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at hole_constraints.hs:3:8-22
- (and originally defined in ‘GHC.Err’))
+ Valid hole fits include f1 :: a
hole_constraints.hs:12:6: warning: [-Wtyped-holes (in -Wdefault)]
• Found hole: _ :: a
@@ -29,13 +25,9 @@ hole_constraints.hs:12:6: warning: [-Wtyped-holes (in -Wdefault)]
Constraints include
Show a (from hole_constraints.hs:11:1-25)
Eq a (from hole_constraints.hs:11:1-25)
- Valid substitutions include
- f2 :: forall a. (Show a, Eq a) => a
- (defined at hole_constraints.hs:12:1)
- f1 :: forall a. Eq a => a (defined at hole_constraints.hs:8:1)
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at hole_constraints.hs:3:8-22
- (and originally defined in ‘GHC.Err’))
+ Valid hole fits include
+ f2 :: a
+ f1 :: forall a. Eq a => a
hole_constraints.hs:16:35: warning: [-Wtyped-holes (in -Wdefault)]
• Found hole: _ :: [a]
@@ -48,15 +40,10 @@ hole_constraints.hs:16:35: warning: [-Wtyped-holes (in -Wdefault)]
• Relevant bindings include
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)
+ Valid hole fits include
+ f3 :: [a]
+ f1 :: forall a. Eq a => a
mempty :: forall a. Monoid a => a
- (imported from ‘Prelude’ at hole_constraints.hs:3:8-22
- (and originally defined in ‘GHC.Base’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at hole_constraints.hs:3:8-22
- (and originally defined in ‘GHC.Err’))
hole_constraints.hs:20:19: warning: [-Wtyped-holes (in -Wdefault)]
• Found hole: _ :: a
@@ -70,10 +57,7 @@ hole_constraints.hs:20:19: warning: [-Wtyped-holes (in -Wdefault)]
x :: a (bound at hole_constraints.hs:20:15)
castWith :: (a :~: b) -> a -> b (bound at hole_constraints.hs:20:1)
Constraints include b ~ a (from hole_constraints.hs:20:10-13)
- Valid substitutions include
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at hole_constraints.hs:3:8-22
- (and originally defined in ‘GHC.Err’))
+ Valid hole fits include x :: a
hole_constraints.hs:27:32: warning: [-Wtyped-holes (in -Wdefault)]
• Found hole: _ :: String
@@ -85,14 +69,8 @@ hole_constraints.hs:27:32: warning: [-Wtyped-holes (in -Wdefault)]
a :: AnyShow (bound at hole_constraints.hs:27:5)
foo :: AnyShow -> String (bound at hole_constraints.hs:27:1)
Constraints include Show a (from hole_constraints.hs:27:19-27)
- Valid substitutions include
+ Valid hole fits include
+ f3 :: forall a. C a => a
+ f1 :: forall a. Eq a => a
f2 :: forall a. (Show a, Eq a) => a
- (defined at hole_constraints.hs:12:1)
- 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’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at hole_constraints.hs:3:8-22
- (and originally defined in ‘GHC.Err’))
diff --git a/testsuite/tests/typecheck/should_compile/hole_constraints_nested.stderr b/testsuite/tests/typecheck/should_compile/hole_constraints_nested.stderr
index 0a721c301f..46c0c22a34 100644
--- a/testsuite/tests/typecheck/should_compile/hole_constraints_nested.stderr
+++ b/testsuite/tests/typecheck/should_compile/hole_constraints_nested.stderr
@@ -13,13 +13,6 @@ hole_constraints_nested.hs:12:16: warning: [-Wtyped-holes (in -Wdefault)]
Eq a (from hole_constraints_nested.hs:12:7-11)
Ord a (from hole_constraints_nested.hs:12:7-11)
b ~ a (from hole_constraints_nested.hs:11:5-8)
- Valid substitutions include
+ Valid hole fits include
maxBound :: forall a. Bounded a => a
- (imported from ‘Prelude’ at hole_constraints_nested.hs:3:8-28
- (and originally defined in ‘GHC.Enum’))
minBound :: forall a. Bounded a => a
- (imported from ‘Prelude’ at hole_constraints_nested.hs:3:8-28
- (and originally defined in ‘GHC.Enum’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at hole_constraints_nested.hs:3:8-28
- (and originally defined in ‘GHC.Err’))
diff --git a/testsuite/tests/typecheck/should_compile/holes.stderr b/testsuite/tests/typecheck/should_compile/holes.stderr
index def250d49d..1df5b49dbb 100644
--- a/testsuite/tests/typecheck/should_compile/holes.stderr
+++ b/testsuite/tests/typecheck/should_compile/holes.stderr
@@ -7,11 +7,7 @@ holes.hs:3:5: warning: [-Wtyped-holes (in -Wdefault)]
• 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. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.Err’))
+ Valid hole fits include f :: forall t. t
holes.hs:6:7: warning: [-Wtyped-holes (in -Wdefault)]
• Found hole: _ :: Char
@@ -20,17 +16,10 @@ holes.hs:6:7: warning: [-Wtyped-holes (in -Wdefault)]
• Relevant bindings include
x :: Int (bound at holes.hs:6:3)
g :: Int -> Char (bound at holes.hs:6:1)
- Valid substitutions include
- f :: forall t. t (defined at holes.hs:3:1)
+ Valid hole fits include
+ f :: forall t. t
maxBound :: forall a. Bounded a => a
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.Enum’))
minBound :: forall a. Bounded a => a
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.Enum’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.Err’))
holes.hs:8:5: warning: [-Wtyped-holes (in -Wdefault)]
• Found hole: _ :: [Char]
@@ -38,15 +27,10 @@ holes.hs:8:5: warning: [-Wtyped-holes (in -Wdefault)]
In the expression: _ ++ "a"
In an equation for ‘h’: h = _ ++ "a"
• Relevant bindings include h :: [Char] (bound at holes.hs:8:1)
- Valid substitutions include
- h :: [Char] (defined at holes.hs:8:1)
- f :: forall t. t (defined at holes.hs:3:1)
+ Valid hole fits include
+ h :: [Char]
+ f :: forall t. t
mempty :: forall a. Monoid a => a
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.Base’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.Err’))
holes.hs:11:15: warning: [-Wtyped-holes (in -Wdefault)]
• Found hole: _ :: b0
@@ -57,449 +41,155 @@ holes.hs:11:15: warning: [-Wtyped-holes (in -Wdefault)]
• Relevant bindings include
y :: [a] (bound at holes.hs:11:3)
z :: [a] -> [a] (bound at holes.hs:11:1)
- Valid substitutions include
- z :: forall a. [a] -> [a] (defined at holes.hs:11:1)
- h :: [Char] (defined at holes.hs:8:1)
- g :: Int -> Char (defined at holes.hs:6:1)
- f :: forall t. t (defined at holes.hs:3:1)
- Left :: forall a b. a -> Either a b
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (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’))
+ Valid hole fits include
+ y :: [a]
+ z :: [a] -> [a]
+ g :: Int -> Char
+ h :: [Char]
+ f :: forall t. t
+ otherwise :: Bool
+ False :: Bool
+ True :: Bool
+ lines :: String -> [String]
+ unlines :: [String] -> String
+ unwords :: [String] -> String
+ words :: String -> [String]
+ userError :: String -> IOError
+ lex :: ReadS String
+ showChar :: Char -> ShowS
+ showParen :: Bool -> ShowS -> ShowS
+ showString :: String -> ShowS
+ appendFile :: FilePath -> String -> IO ()
+ getChar :: IO Char
+ getContents :: IO String
+ getLine :: IO String
+ interact :: (String -> String) -> IO ()
+ putChar :: Char -> IO ()
+ putStr :: String -> IO ()
+ putStrLn :: String -> IO ()
+ readFile :: FilePath -> IO String
+ writeFile :: FilePath -> String -> IO ()
+ (&&) :: Bool -> Bool -> Bool
+ not :: Bool -> Bool
+ (||) :: Bool -> Bool -> Bool
EQ :: Ordering
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.Types’))
LT :: 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’))
- 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’))
- divMod :: forall a. Integral a => 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’))
- significand :: forall a. RealFloat a => 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’))
- 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’))
- floatRange :: forall a. RealFloat a => a -> (Int, 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’))
- 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’))
- 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’))
- 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’))
- 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’))
- 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’))
- encodeFloat :: forall a. RealFloat a => Integer -> Int -> 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’))
- atan2 :: forall a. RealFloat 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’))
+ (++) :: forall a. [a] -> [a] -> [a]
+ filter :: forall a. (a -> Bool) -> [a] -> [a]
+ fromInteger :: forall a. Num a => Integer -> a
+ (-) :: forall a. Num a => a -> a -> a
+ fromRational :: forall a. Fractional a => Rational -> a
+ negate :: forall a. Num a => a -> a
+ fromIntegral :: forall a b. (Integral a, Num b) => a -> b
+ toInteger :: forall a. Integral a => a -> Integer
+ toRational :: forall a. Real a => a -> Rational
+ Nothing :: forall a. Maybe a
+ Just :: forall a. a -> Maybe a
+ asTypeOf :: forall a. a -> a -> a
+ id :: forall a. a -> a
+ until :: forall a. (a -> Bool) -> (a -> a) -> a -> a
+ ioError :: forall a. IOError -> IO a
+ (!!) :: forall a. [a] -> Int -> a
+ break :: forall a. (a -> Bool) -> [a] -> ([a], [a])
+ cycle :: forall a. [a] -> [a]
+ drop :: forall a. Int -> [a] -> [a]
+ dropWhile :: forall a. (a -> Bool) -> [a] -> [a]
+ head :: forall a. [a] -> a
+ init :: forall a. [a] -> [a]
+ iterate :: forall a. (a -> a) -> a -> [a]
+ last :: forall a. [a] -> a
+ repeat :: forall a. a -> [a]
+ replicate :: forall a. Int -> a -> [a]
+ reverse :: forall a. [a] -> [a]
+ scanl1 :: forall a. (a -> a -> a) -> [a] -> [a]
+ scanr1 :: forall a. (a -> a -> a) -> [a] -> [a]
+ span :: forall a. (a -> Bool) -> [a] -> ([a], [a])
+ splitAt :: forall a. Int -> [a] -> ([a], [a])
+ tail :: forall a. [a] -> [a]
+ take :: forall a. Int -> [a] -> [a]
+ takeWhile :: forall a. (a -> Bool) -> [a] -> [a]
+ subtract :: forall a. Num a => a -> a -> a
+ readParen :: forall a. Bool -> ReadS a -> ReadS a
+ (^) :: forall a b. (Num a, Integral b) => a -> b -> a
+ even :: forall a. Integral a => a -> Bool
+ gcd :: forall a. Integral a => a -> a -> a
+ lcm :: forall a. Integral a => a -> a -> a
+ odd :: forall a. Integral a => a -> Bool
+ (**) :: forall a. Floating a => a -> a -> a
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’))
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’))
exp :: forall a. Floating a => a -> a
- (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
+ pi :: forall a. Floating a => a
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’))
- recip :: forall a. Fractional a => a -> a
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.Real’))
- (**) :: forall a. Floating a => 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’))
+ atan2 :: forall a. RealFloat a => a -> a -> a
+ decodeFloat :: forall a. RealFloat a => a -> (Integer, Int)
+ encodeFloat :: forall a. RealFloat a => Integer -> Int -> a
+ exponent :: forall a. RealFloat a => a -> Int
+ floatDigits :: forall a. RealFloat a => a -> Int
+ floatRadix :: forall a. RealFloat a => a -> Integer
+ floatRange :: forall a. RealFloat a => a -> (Int, Int)
+ isDenormalized :: forall a. RealFloat a => a -> Bool
+ isIEEE :: forall a. RealFloat a => a -> Bool
+ isInfinite :: forall a. RealFloat a => a -> Bool
+ isNaN :: forall a. RealFloat a => a -> Bool
+ isNegativeZero :: forall a. RealFloat a => a -> Bool
+ scaleFloat :: forall a. RealFloat a => Int -> a -> a
+ significand :: forall a. RealFloat a => a -> a
+ (*) :: forall a. Num a => a -> a -> a
+ (+) :: forall a. Num a => a -> a -> a
+ abs :: forall a. Num a => a -> a
+ signum :: forall a. Num a => a -> a
(/) :: forall a. Fractional a => a -> a -> a
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.Real’))
- 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’))
- (||) :: Bool -> Bool -> Bool
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.Classes’))
- readFile :: FilePath -> IO String
- (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’))
- putChar :: Char -> IO ()
- (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’))
- 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’))
- getChar :: IO Char
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘System.IO’))
- appendFile :: FilePath -> String -> IO ()
- (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’))
- showString :: String -> 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’))
- showChar :: Char -> ShowS
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.Show’))
- 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’))
+ recip :: forall a. Fractional a => a -> a
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)
mod :: forall a. Integral a => a -> a -> 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)
rem :: forall a. Integral 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’))
- odd :: forall a. Integral a => a -> Bool
- (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’))
- (^) :: 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’))
- readParen :: forall a. Bool -> ReadS a -> ReadS a
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.Read’))
- lex :: ReadS String
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.Read’))
- 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’))
- 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’))
- 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’))
- 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’))
- unzip :: forall a b. [(a, b)] -> ([a], [b])
- (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’))
- 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’))
- scanl1 :: forall a. (a -> a -> a) -> [a] -> [a]
- (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’))
- 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’))
- replicate :: forall a. Int -> 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’))
- drop :: forall a. Int -> [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’))
- cycle :: 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’))
- reverse :: forall 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’))
- break :: forall a. (a -> Bool) -> [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’))
- (!!) :: forall a. [a] -> Int -> a
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.List’))
- userError :: String -> IOError
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.IO.Exception’))
- ioError :: forall a. IOError -> IO a
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.IO.Exception’))
- until :: forall a. (a -> Bool) -> (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’))
- (.) :: 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’))
- 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’))
- 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’))
- unlines :: [String] -> String
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘base-4.12.0.0:Data.OldList’))
- unwords :: [String] -> String
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘base-4.12.0.0:Data.OldList’))
- head :: forall 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’))
- lines :: String -> [String]
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘base-4.12.0.0:Data.OldList’))
- words :: String -> [String]
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘base-4.12.0.0:Data.OldList’))
- repeat :: forall a. a -> [a]
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.List’))
- error :: forall a. GHC.Stack.Types.HasCallStack => [Char] -> a
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.Err’))
- errorWithoutStackTrace :: forall a. [Char] -> a
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.Err’))
- 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’))
- 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’))
- Just :: forall a. a -> Maybe a
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.Base’))
- Nothing :: forall a. Maybe a
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.Base’))
- toRational :: forall a. Real a => a -> Rational
- (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’))
- negate :: forall a. Num 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’))
- signum :: forall a. Num a => a -> a
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.Num’))
- fromRational :: forall a. Fractional a => Rational -> a
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.Real’))
+ seq :: forall a b. a -> b -> b
+ zip :: forall a b. [a] -> [b] -> [(a, b)]
+ fst :: forall a b. (a, b) -> a
+ snd :: forall a b. (a, b) -> b
+ map :: forall a b. (a -> b) -> [a] -> [b]
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’))
- (-) :: forall a. Num a => 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. 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’))
- fromInteger :: forall a. Num a => Integer -> a
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.Num’))
- 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’))
+ maybe :: forall b a. b -> (a -> b) -> Maybe a -> b
+ const :: forall a b. a -> b -> a
+ scanl :: forall b a. (b -> a -> b) -> b -> [a] -> [b]
+ scanr :: forall a b. (a -> b -> b) -> b -> [a] -> [b]
+ unzip :: forall a b. [(a, b)] -> ([a], [b])
+ (^^) :: forall a b. (Fractional a, Integral b) => a -> b -> a
+ ceiling :: forall a. RealFrac a => forall b. Integral b => a -> b
+ floor :: forall a. RealFrac a => forall b. Integral b => a -> b
+ properFraction :: forall a.
+ RealFrac a =>
+ forall b. Integral b => a -> (b, a)
+ round :: forall a. RealFrac a => forall b. Integral b => a -> b
+ truncate :: forall a. RealFrac a => forall b. Integral b => a -> b
+ Right :: forall a b. b -> Either a b
+ Left :: forall a b. a -> Either a b
($) :: forall a b. (a -> b) -> a -> b
- (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
+ curry :: forall a b c. ((a, b) -> c) -> a -> b -> c
+ uncurry :: forall a b c. (a -> b -> c) -> (a, b) -> c
($!) :: forall a b. (a -> b) -> a -> b
- (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’))
- 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’))
- snd :: forall a b. (a, b) -> b
- (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’))
- zip :: forall a b. [a] -> [b] -> [(a, b)]
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.List’))
- filter :: forall a. (a -> Bool) -> [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’))
- takeWhile :: forall a. (a -> Bool) -> [a] -> [a]
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.List’))
- (++) :: forall a. [a] -> [a] -> [a]
- (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’))
- const :: forall a b. a -> b -> a
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.Base’))
- seq :: forall a b. a -> b -> b
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.Prim’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at holes.hs:1:8-12
- (and originally defined in ‘GHC.Err’))
+ (.) :: forall b c a. (b -> c) -> (a -> b) -> a -> c
+ flip :: forall a b c. (a -> b -> c) -> b -> a -> c
+ unzip3 :: forall a b c. [(a, b, c)] -> ([a], [b], [c])
+ zip3 :: forall a b c. [a] -> [b] -> [c] -> [(a, b, c)]
+ zipWith :: forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
+ zipWith3 :: forall a b c d.
+ (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
diff --git a/testsuite/tests/typecheck/should_compile/holes2.stderr b/testsuite/tests/typecheck/should_compile/holes2.stderr
index 7e14eeac69..6421709f85 100644
--- a/testsuite/tests/typecheck/should_compile/holes2.stderr
+++ b/testsuite/tests/typecheck/should_compile/holes2.stderr
@@ -21,26 +21,12 @@ holes2.hs:3:10: warning: [-Wtyped-holes (in -Wdefault)]
In the expression: show _
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)
+ Valid hole fits include
+ f :: String
+ otherwise :: Bool
+ False :: Bool
+ True :: Bool
EQ :: Ordering
- (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’))
GT :: Ordering
- (imported from ‘Prelude’ at holes2.hs:1:8-13
- (and originally defined in ‘GHC.Types’))
pi :: forall a. Floating a => a
- (imported from ‘Prelude’ at holes2.hs:1:8-13
- (and originally defined in ‘GHC.Float’))
- otherwise :: Bool
- (imported from ‘Prelude’ at holes2.hs:1:8-13
- (and originally defined in ‘GHC.Base’))
- 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’))
diff --git a/testsuite/tests/typecheck/should_compile/holes3.stderr b/testsuite/tests/typecheck/should_compile/holes3.stderr
index 08a20da52c..be14099d30 100644
--- a/testsuite/tests/typecheck/should_compile/holes3.stderr
+++ b/testsuite/tests/typecheck/should_compile/holes3.stderr
@@ -7,11 +7,7 @@ holes3.hs:3:5: error:
• 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. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.Err’))
+ Valid hole fits include f :: forall t. t
holes3.hs:6:7: error:
• Found hole: _gr :: Char
@@ -21,17 +17,10 @@ holes3.hs:6:7: error:
• Relevant bindings include
x :: Int (bound at holes3.hs:6:3)
g :: Int -> Char (bound at holes3.hs:6:1)
- Valid substitutions include
- f :: forall t. t (defined at holes3.hs:3:1)
+ Valid hole fits include
+ f :: forall t. t
maxBound :: forall a. Bounded a => a
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.Enum’))
minBound :: forall a. Bounded a => a
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.Enum’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.Err’))
holes3.hs:8:5: error:
• Found hole: _aa :: [Char]
@@ -40,15 +29,10 @@ holes3.hs:8:5: error:
In the expression: _aa ++ "a"
In an equation for ‘h’: h = _aa ++ "a"
• Relevant bindings include h :: [Char] (bound at holes3.hs:8:1)
- Valid substitutions include
- h :: [Char] (defined at holes3.hs:8:1)
- f :: forall t. t (defined at holes3.hs:3:1)
+ Valid hole fits include
+ h :: [Char]
+ f :: forall t. t
mempty :: forall a. Monoid a => a
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.Base’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.Err’))
holes3.hs:11:15: error:
• Found hole: _x :: b0
@@ -60,449 +44,155 @@ holes3.hs:11:15: error:
• Relevant bindings include
y :: [a] (bound at holes3.hs:11:3)
z :: [a] -> [a] (bound at holes3.hs:11:1)
- Valid substitutions include
- z :: forall a. [a] -> [a] (defined at holes3.hs:11:1)
- h :: [Char] (defined at holes3.hs:8:1)
- g :: Int -> Char (defined at holes3.hs:6:1)
- f :: forall t. t (defined at holes3.hs:3:1)
- Left :: forall a b. a -> Either a b
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (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’))
+ Valid hole fits include
+ y :: [a]
+ z :: [a] -> [a]
+ g :: Int -> Char
+ h :: [Char]
+ f :: forall t. t
+ otherwise :: Bool
+ False :: Bool
+ True :: Bool
+ lines :: String -> [String]
+ unlines :: [String] -> String
+ unwords :: [String] -> String
+ words :: String -> [String]
+ userError :: String -> IOError
+ lex :: ReadS String
+ showChar :: Char -> ShowS
+ showParen :: Bool -> ShowS -> ShowS
+ showString :: String -> ShowS
+ appendFile :: FilePath -> String -> IO ()
+ getChar :: IO Char
+ getContents :: IO String
+ getLine :: IO String
+ interact :: (String -> String) -> IO ()
+ putChar :: Char -> IO ()
+ putStr :: String -> IO ()
+ putStrLn :: String -> IO ()
+ readFile :: FilePath -> IO String
+ writeFile :: FilePath -> String -> IO ()
+ (&&) :: Bool -> Bool -> Bool
+ not :: Bool -> Bool
+ (||) :: Bool -> Bool -> Bool
EQ :: Ordering
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.Types’))
LT :: 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’))
- 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’))
- divMod :: forall a. Integral a => 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’))
- significand :: forall a. RealFloat a => 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’))
- 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’))
- floatRange :: forall a. RealFloat a => a -> (Int, 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’))
- 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’))
- 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’))
- 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’))
- 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’))
- 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’))
- encodeFloat :: forall a. RealFloat a => Integer -> Int -> 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’))
- atan2 :: forall a. RealFloat 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’))
+ (++) :: forall a. [a] -> [a] -> [a]
+ filter :: forall a. (a -> Bool) -> [a] -> [a]
+ fromInteger :: forall a. Num a => Integer -> a
+ (-) :: forall a. Num a => a -> a -> a
+ fromRational :: forall a. Fractional a => Rational -> a
+ negate :: forall a. Num a => a -> a
+ fromIntegral :: forall a b. (Integral a, Num b) => a -> b
+ toInteger :: forall a. Integral a => a -> Integer
+ toRational :: forall a. Real a => a -> Rational
+ Nothing :: forall a. Maybe a
+ Just :: forall a. a -> Maybe a
+ asTypeOf :: forall a. a -> a -> a
+ id :: forall a. a -> a
+ until :: forall a. (a -> Bool) -> (a -> a) -> a -> a
+ ioError :: forall a. IOError -> IO a
+ (!!) :: forall a. [a] -> Int -> a
+ break :: forall a. (a -> Bool) -> [a] -> ([a], [a])
+ cycle :: forall a. [a] -> [a]
+ drop :: forall a. Int -> [a] -> [a]
+ dropWhile :: forall a. (a -> Bool) -> [a] -> [a]
+ head :: forall a. [a] -> a
+ init :: forall a. [a] -> [a]
+ iterate :: forall a. (a -> a) -> a -> [a]
+ last :: forall a. [a] -> a
+ repeat :: forall a. a -> [a]
+ replicate :: forall a. Int -> a -> [a]
+ reverse :: forall a. [a] -> [a]
+ scanl1 :: forall a. (a -> a -> a) -> [a] -> [a]
+ scanr1 :: forall a. (a -> a -> a) -> [a] -> [a]
+ span :: forall a. (a -> Bool) -> [a] -> ([a], [a])
+ splitAt :: forall a. Int -> [a] -> ([a], [a])
+ tail :: forall a. [a] -> [a]
+ take :: forall a. Int -> [a] -> [a]
+ takeWhile :: forall a. (a -> Bool) -> [a] -> [a]
+ subtract :: forall a. Num a => a -> a -> a
+ readParen :: forall a. Bool -> ReadS a -> ReadS a
+ (^) :: forall a b. (Num a, Integral b) => a -> b -> a
+ even :: forall a. Integral a => a -> Bool
+ gcd :: forall a. Integral a => a -> a -> a
+ lcm :: forall a. Integral a => a -> a -> a
+ odd :: forall a. Integral a => a -> Bool
+ (**) :: forall a. Floating a => a -> a -> a
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’))
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’))
exp :: forall a. Floating a => a -> a
- (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
+ pi :: forall a. Floating a => a
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’))
- recip :: forall a. Fractional a => a -> a
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.Real’))
- (**) :: forall a. Floating a => 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’))
+ atan2 :: forall a. RealFloat a => a -> a -> a
+ decodeFloat :: forall a. RealFloat a => a -> (Integer, Int)
+ encodeFloat :: forall a. RealFloat a => Integer -> Int -> a
+ exponent :: forall a. RealFloat a => a -> Int
+ floatDigits :: forall a. RealFloat a => a -> Int
+ floatRadix :: forall a. RealFloat a => a -> Integer
+ floatRange :: forall a. RealFloat a => a -> (Int, Int)
+ isDenormalized :: forall a. RealFloat a => a -> Bool
+ isIEEE :: forall a. RealFloat a => a -> Bool
+ isInfinite :: forall a. RealFloat a => a -> Bool
+ isNaN :: forall a. RealFloat a => a -> Bool
+ isNegativeZero :: forall a. RealFloat a => a -> Bool
+ scaleFloat :: forall a. RealFloat a => Int -> a -> a
+ significand :: forall a. RealFloat a => a -> a
+ (*) :: forall a. Num a => a -> a -> a
+ (+) :: forall a. Num a => a -> a -> a
+ abs :: forall a. Num a => a -> a
+ signum :: forall a. Num a => a -> a
(/) :: forall a. Fractional a => a -> a -> a
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.Real’))
- 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’))
- (||) :: Bool -> Bool -> Bool
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.Classes’))
- readFile :: FilePath -> IO String
- (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’))
- putChar :: Char -> IO ()
- (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’))
- 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’))
- getChar :: IO Char
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘System.IO’))
- appendFile :: FilePath -> String -> IO ()
- (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’))
- showString :: String -> 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’))
- showChar :: Char -> ShowS
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.Show’))
- 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’))
+ recip :: forall a. Fractional a => a -> a
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)
mod :: forall a. Integral a => a -> a -> 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)
rem :: forall a. Integral 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’))
- odd :: forall a. Integral a => a -> Bool
- (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’))
- (^) :: 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’))
- readParen :: forall a. Bool -> ReadS a -> ReadS a
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.Read’))
- lex :: ReadS String
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.Read’))
- 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’))
- 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’))
- 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’))
- 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’))
- unzip :: forall a b. [(a, b)] -> ([a], [b])
- (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’))
- 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’))
- scanl1 :: forall a. (a -> a -> a) -> [a] -> [a]
- (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’))
- 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’))
- replicate :: forall a. Int -> 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’))
- drop :: forall a. Int -> [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’))
- cycle :: 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’))
- reverse :: forall 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’))
- break :: forall a. (a -> Bool) -> [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’))
- (!!) :: forall a. [a] -> Int -> a
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.List’))
- userError :: String -> IOError
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.IO.Exception’))
- ioError :: forall a. IOError -> IO a
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.IO.Exception’))
- until :: forall a. (a -> Bool) -> (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’))
- (.) :: 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’))
- 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’))
- 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’))
- unlines :: [String] -> String
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘base-4.12.0.0:Data.OldList’))
- unwords :: [String] -> String
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘base-4.12.0.0:Data.OldList’))
- head :: forall 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’))
- lines :: String -> [String]
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘base-4.12.0.0:Data.OldList’))
- words :: String -> [String]
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘base-4.12.0.0:Data.OldList’))
- repeat :: forall a. a -> [a]
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.List’))
- error :: forall a. GHC.Stack.Types.HasCallStack => [Char] -> a
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.Err’))
- errorWithoutStackTrace :: forall a. [Char] -> a
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.Err’))
- 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’))
- 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’))
- Just :: forall a. a -> Maybe a
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.Base’))
- Nothing :: forall a. Maybe a
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.Base’))
- toRational :: forall a. Real a => a -> Rational
- (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’))
- negate :: forall a. Num 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’))
- signum :: forall a. Num a => a -> a
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.Num’))
- fromRational :: forall a. Fractional a => Rational -> a
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.Real’))
+ seq :: forall a b. a -> b -> b
+ zip :: forall a b. [a] -> [b] -> [(a, b)]
+ fst :: forall a b. (a, b) -> a
+ snd :: forall a b. (a, b) -> b
+ map :: forall a b. (a -> b) -> [a] -> [b]
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’))
- (-) :: forall a. Num a => 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. 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’))
- fromInteger :: forall a. Num a => Integer -> a
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.Num’))
- 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’))
+ maybe :: forall b a. b -> (a -> b) -> Maybe a -> b
+ const :: forall a b. a -> b -> a
+ scanl :: forall b a. (b -> a -> b) -> b -> [a] -> [b]
+ scanr :: forall a b. (a -> b -> b) -> b -> [a] -> [b]
+ unzip :: forall a b. [(a, b)] -> ([a], [b])
+ (^^) :: forall a b. (Fractional a, Integral b) => a -> b -> a
+ ceiling :: forall a. RealFrac a => forall b. Integral b => a -> b
+ floor :: forall a. RealFrac a => forall b. Integral b => a -> b
+ properFraction :: forall a.
+ RealFrac a =>
+ forall b. Integral b => a -> (b, a)
+ round :: forall a. RealFrac a => forall b. Integral b => a -> b
+ truncate :: forall a. RealFrac a => forall b. Integral b => a -> b
+ Right :: forall a b. b -> Either a b
+ Left :: forall a b. a -> Either a b
($) :: forall a b. (a -> b) -> a -> b
- (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
+ curry :: forall a b c. ((a, b) -> c) -> a -> b -> c
+ uncurry :: forall a b c. (a -> b -> c) -> (a, b) -> c
($!) :: forall a b. (a -> b) -> a -> b
- (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’))
- 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’))
- snd :: forall a b. (a, b) -> b
- (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’))
- zip :: forall a b. [a] -> [b] -> [(a, b)]
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.List’))
- filter :: forall a. (a -> Bool) -> [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’))
- takeWhile :: forall a. (a -> Bool) -> [a] -> [a]
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.List’))
- (++) :: forall a. [a] -> [a] -> [a]
- (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’))
- const :: forall a b. a -> b -> a
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.Base’))
- seq :: forall a b. a -> b -> b
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.Prim’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at holes3.hs:1:8-13
- (and originally defined in ‘GHC.Err’))
+ (.) :: forall b c a. (b -> c) -> (a -> b) -> a -> c
+ flip :: forall a b c. (a -> b -> c) -> b -> a -> c
+ unzip3 :: forall a b c. [(a, b, c)] -> ([a], [b], [c])
+ zip3 :: forall a b c. [a] -> [b] -> [c] -> [(a, b, c)]
+ zipWith :: forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
+ zipWith3 :: forall a b c d.
+ (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
diff --git a/testsuite/tests/typecheck/should_compile/local_hole_fits.hs b/testsuite/tests/typecheck/should_compile/local_hole_fits.hs
new file mode 100755
index 0000000000..8e257ffe61
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/local_hole_fits.hs
@@ -0,0 +1,11 @@
+import Prelude (Show, String, error, IO(), show, Ordering(EQ))
+
+head :: [a] -> a
+head (x:xs) = _
+head _ = error "Empty list!"
+
+mshow :: Show a => a -> a
+mshow a = _
+
+main :: IO ()
+main = error "no main"
diff --git a/testsuite/tests/typecheck/should_compile/local_hole_fits.stderr b/testsuite/tests/typecheck/should_compile/local_hole_fits.stderr
new file mode 100644
index 0000000000..5485d05bef
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/local_hole_fits.stderr
@@ -0,0 +1,28 @@
+
+local_hole_fits.hs:4:15: warning: [-Wtyped-holes (in -Wdefault)]
+ • Found hole: _ :: a
+ Where: ‘a’ is a rigid type variable bound by
+ the type signature for:
+ head :: forall a. [a] -> a
+ at local_hole_fits.hs:3:1-16
+ • In the expression: _
+ In an equation for ‘head’: head (x : xs) = _
+ • Relevant bindings include
+ xs :: [a] (bound at local_hole_fits.hs:4:9)
+ x :: a (bound at local_hole_fits.hs:4:7)
+ head :: [a] -> a (bound at local_hole_fits.hs:4:1)
+ Valid hole fits include x :: a (bound at local_hole_fits.hs:4:7)
+
+local_hole_fits.hs:8:11: warning: [-Wtyped-holes (in -Wdefault)]
+ • Found hole: _ :: a
+ Where: ‘a’ is a rigid type variable bound by
+ the type signature for:
+ mshow :: forall a. Show a => a -> a
+ at local_hole_fits.hs:7:1-25
+ • In the expression: _
+ In an equation for ‘mshow’: mshow a = _
+ • Relevant bindings include
+ a :: a (bound at local_hole_fits.hs:8:7)
+ mshow :: a -> a (bound at local_hole_fits.hs:8:1)
+ Constraints include Show a (from local_hole_fits.hs:7:1-25)
+ Valid hole fits include a :: a (bound at local_hole_fits.hs:8:7)
diff --git a/testsuite/tests/typecheck/should_compile/refinement_substitutions.hs b/testsuite/tests/typecheck/should_compile/refinement_hole_fits.hs
index 345a6c8f8e..345a6c8f8e 100644
--- a/testsuite/tests/typecheck/should_compile/refinement_substitutions.hs
+++ b/testsuite/tests/typecheck/should_compile/refinement_hole_fits.hs
diff --git a/testsuite/tests/typecheck/should_compile/refinement_hole_fits.stderr b/testsuite/tests/typecheck/should_compile/refinement_hole_fits.stderr
new file mode 100644
index 0000000000..96e93bfd0f
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/refinement_hole_fits.stderr
@@ -0,0 +1,236 @@
+
+refinement_hole_fits.hs:4:5: warning: [-Wtyped-holes (in -Wdefault)]
+ • Found hole: _ :: [Integer] -> Integer
+ • In the expression: _
+ In an equation for ‘f’: f = _
+ • Relevant bindings include
+ f :: [Integer] -> Integer (bound at refinement_hole_fits.hs:4:1)
+ Valid hole fits include
+ f :: [Integer] -> Integer (bound at refinement_hole_fits.hs:4:1)
+ g :: [Integer] -> Integer (bound at refinement_hole_fits.hs:7:1)
+ head :: forall a. [a] -> a
+ with head @Integer
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.List’))
+ last :: forall a. [a] -> a
+ with last @Integer
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.List’))
+ maximum :: forall (t :: * -> *).
+ Foldable t =>
+ forall a. Ord a => t a -> a
+ with maximum @[] @Integer
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘Data.Foldable’))
+ minimum :: forall (t :: * -> *).
+ Foldable t =>
+ forall a. Ord a => t a -> a
+ with minimum @[] @Integer
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘Data.Foldable’))
+ product :: forall (t :: * -> *).
+ Foldable t =>
+ forall a. Num a => t a -> a
+ with product @[] @Integer
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘Data.Foldable’))
+ sum :: forall (t :: * -> *).
+ Foldable t =>
+ forall a. Num a => t a -> a
+ with sum @[] @Integer
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘Data.Foldable’))
+ Valid refinement hole fits include
+ foldl1 (_ :: Integer -> Integer -> Integer)
+ where foldl1 :: forall (t :: * -> *).
+ Foldable t =>
+ forall a. (a -> a -> a) -> t a -> a
+ with foldl1 @[] @Integer
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘Data.Foldable’))
+ foldr1 (_ :: Integer -> Integer -> Integer)
+ where foldr1 :: forall (t :: * -> *).
+ Foldable t =>
+ forall a. (a -> a -> a) -> t a -> a
+ with foldr1 @[] @Integer
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘Data.Foldable’))
+ foldl (_ :: Integer -> Integer -> Integer) (_ :: Integer)
+ where foldl :: forall (t :: * -> *).
+ Foldable t =>
+ forall b a. (b -> a -> b) -> b -> t a -> b
+ with foldl @[] @Integer @Integer
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘Data.Foldable’))
+ foldr (_ :: Integer -> Integer -> Integer) (_ :: Integer)
+ where foldr :: forall (t :: * -> *).
+ Foldable t =>
+ forall a b. (a -> b -> b) -> b -> t a -> b
+ with foldr @[] @Integer @Integer
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘Data.Foldable’))
+ const (_ :: Integer)
+ where const :: forall a b. a -> b -> a
+ with const @Integer @[Integer]
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.Base’))
+ ($) (_ :: [Integer] -> Integer)
+ where ($) :: forall a b. (a -> b) -> a -> b
+ with ($) @'GHC.Types.LiftedRep @[Integer] @Integer
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.Base’))
+ fail (_ :: String)
+ where fail :: forall (m :: * -> *).
+ Monad m =>
+ forall a. String -> m a
+ with fail @((->) [Integer]) @Integer
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.Base’))
+ return (_ :: Integer)
+ where return :: forall (m :: * -> *). Monad m => forall a. a -> m a
+ with return @((->) [Integer]) @Integer
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.Base’))
+ pure (_ :: Integer)
+ where pure :: forall (f :: * -> *).
+ Applicative f =>
+ forall a. a -> f a
+ with pure @((->) [Integer]) @Integer
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.Base’))
+ ($!) (_ :: [Integer] -> Integer)
+ where ($!) :: forall a b. (a -> b) -> a -> b
+ with ($!) @'GHC.Types.LiftedRep @[Integer] @Integer
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.Base’))
+ id (_ :: [Integer] -> Integer)
+ where id :: forall a. a -> a
+ with id @([Integer] -> Integer)
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.Base’))
+ head (_ :: [[Integer] -> Integer])
+ where head :: forall a. [a] -> a
+ with head @([Integer] -> Integer)
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.List’))
+ last (_ :: [[Integer] -> Integer])
+ where last :: forall a. [a] -> a
+ with last @([Integer] -> Integer)
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.List’))
+ asTypeOf (_ :: [Integer] -> Integer) (_ :: [Integer] -> Integer)
+ where asTypeOf :: forall a. a -> a -> a
+ with asTypeOf @([Integer] -> Integer)
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.Base’))
+ (!!) (_ :: [[Integer] -> Integer]) (_ :: Int)
+ where (!!) :: forall a. [a] -> Int -> a
+ with (!!) @([Integer] -> Integer)
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.List’))
+
+refinement_hole_fits.hs:7:5: warning: [-Wtyped-holes (in -Wdefault)]
+ • Found hole: _ :: Integer -> [Integer] -> Integer
+ • In the expression: _
+ In the expression: _ 0
+ In an equation for ‘g’: g = _ 0
+ • Relevant bindings include
+ g :: [Integer] -> Integer (bound at refinement_hole_fits.hs:7:1)
+ Valid hole fits include
+ const :: forall a b. a -> b -> a
+ with const @Integer @[Integer]
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.Base’))
+ return :: forall (m :: * -> *). Monad m => forall a. a -> m a
+ with return @((->) [Integer]) @Integer
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.Base’))
+ pure :: forall (f :: * -> *). Applicative f => forall a. a -> f a
+ with pure @((->) [Integer]) @Integer
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.Base’))
+ Valid refinement hole fits include
+ foldl (_ :: Integer -> Integer -> Integer)
+ where foldl :: forall (t :: * -> *).
+ Foldable t =>
+ forall b a. (b -> a -> b) -> b -> t a -> b
+ with foldl @[] @Integer @Integer
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘Data.Foldable’))
+ foldr (_ :: Integer -> Integer -> Integer)
+ where foldr :: forall (t :: * -> *).
+ Foldable t =>
+ forall a b. (a -> b -> b) -> b -> t a -> b
+ with foldr @[] @Integer @Integer
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘Data.Foldable’))
+ curry (_ :: (Integer, [Integer]) -> Integer)
+ where curry :: forall a b c. ((a, b) -> c) -> a -> b -> c
+ with curry @Integer @[Integer] @Integer
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘Data.Tuple’))
+ flip (_ :: [Integer] -> Integer -> Integer)
+ where flip :: forall a b c. (a -> b -> c) -> b -> a -> c
+ with flip @[Integer] @Integer @Integer
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.Base’))
+ const (_ :: [Integer] -> Integer)
+ where const :: forall a b. a -> b -> a
+ with const @([Integer] -> Integer) @Integer
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.Base’))
+ ($) (_ :: Integer -> [Integer] -> Integer)
+ where ($) :: forall a b. (a -> b) -> a -> b
+ with ($) @'GHC.Types.LiftedRep @Integer @([Integer] -> Integer)
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.Base’))
+ fail (_ :: String)
+ where fail :: forall (m :: * -> *).
+ Monad m =>
+ forall a. String -> m a
+ with fail @((->) Integer) @([Integer] -> Integer)
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.Base’))
+ return (_ :: [Integer] -> Integer)
+ where return :: forall (m :: * -> *). Monad m => forall a. a -> m a
+ with return @((->) Integer) @([Integer] -> Integer)
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.Base’))
+ pure (_ :: [Integer] -> Integer)
+ where pure :: forall (f :: * -> *).
+ Applicative f =>
+ forall a. a -> f a
+ with pure @((->) Integer) @([Integer] -> Integer)
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.Base’))
+ ($!) (_ :: Integer -> [Integer] -> Integer)
+ where ($!) :: forall a b. (a -> b) -> a -> b
+ with ($!) @'GHC.Types.LiftedRep @Integer @([Integer] -> Integer)
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.Base’))
+ id (_ :: Integer -> [Integer] -> Integer)
+ where id :: forall a. a -> a
+ with id @(Integer -> [Integer] -> Integer)
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.Base’))
+ head (_ :: [Integer -> [Integer] -> Integer])
+ where head :: forall a. [a] -> a
+ with head @(Integer -> [Integer] -> Integer)
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.List’))
+ last (_ :: [Integer -> [Integer] -> Integer])
+ where last :: forall a. [a] -> a
+ with last @(Integer -> [Integer] -> Integer)
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.List’))
+ asTypeOf (_ :: Integer -> [Integer] -> Integer)
+ (_ :: Integer -> [Integer] -> Integer)
+ where asTypeOf :: forall a. a -> a -> a
+ with asTypeOf @(Integer -> [Integer] -> Integer)
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.Base’))
+ (!!) (_ :: [Integer -> [Integer] -> Integer]) (_ :: Int)
+ where (!!) :: forall a. [a] -> Int -> a
+ with (!!) @(Integer -> [Integer] -> Integer)
+ (imported from ‘Prelude’ at refinement_hole_fits.hs:1:8-30
+ (and originally defined in ‘GHC.List’))
diff --git a/testsuite/tests/typecheck/should_compile/refinement_substitutions.stderr b/testsuite/tests/typecheck/should_compile/refinement_substitutions.stderr
deleted file mode 100644
index 0b3795894e..0000000000
--- a/testsuite/tests/typecheck/should_compile/refinement_substitutions.stderr
+++ /dev/null
@@ -1,330 +0,0 @@
-
-refinement_substitutions.hs:4:5: warning: [-Wtyped-holes (in -Wdefault)]
- • Found hole: _ :: [Integer] -> Integer
- • In the expression: _
- In an equation for ‘f’: f = _
- • Relevant bindings include
- f :: [Integer] -> Integer
- (bound at refinement_substitutions.hs:4:1)
- Valid substitutions include
- f :: [Integer] -> Integer
- (defined at refinement_substitutions.hs:4:1)
- g :: [Integer] -> Integer
- (defined at refinement_substitutions.hs:7:1)
- product :: forall (t :: * -> *).
- Foldable t =>
- forall a. Num a => t a -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘Data.Foldable’))
- sum :: forall (t :: * -> *).
- Foldable t =>
- forall a. Num a => t a -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘Data.Foldable’))
- maximum :: forall (t :: * -> *).
- Foldable t =>
- forall a. Ord a => t a -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘Data.Foldable’))
- minimum :: forall (t :: * -> *).
- Foldable t =>
- forall a. Ord a => t a -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘Data.Foldable’))
- head :: forall a. [a] -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.List’))
- last :: forall a. [a] -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.List’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Err’))
- Valid refinement substitutions include
- (<$) _ _ :: forall (f :: * -> *).
- Functor f =>
- forall a b. a -> f b -> f a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- (<*) _ _ :: forall (f :: * -> *).
- Applicative f =>
- forall a b. f a -> f b -> f a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- foldr _ _ :: forall (t :: * -> *).
- Foldable t =>
- forall a b. (a -> b -> b) -> b -> t a -> b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘Data.Foldable’))
- foldl1 _ :: forall (t :: * -> *).
- Foldable t =>
- forall a. (a -> a -> a) -> t a -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘Data.Foldable’))
- foldr1 _ :: forall (t :: * -> *).
- Foldable t =>
- forall a. (a -> a -> a) -> t a -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘Data.Foldable’))
- foldl _ _ :: forall (t :: * -> *).
- Foldable t =>
- forall b a. (b -> a -> b) -> b -> t a -> b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘Data.Foldable’))
- head _ :: forall a. [a] -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.List’))
- last _ :: forall a. [a] -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.List’))
- (!!) _ _ :: forall a. [a] -> Int -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.List’))
- flip _ _ :: forall a b c. (a -> b -> c) -> b -> a -> c
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- const _ :: forall a b. a -> b -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- asTypeOf _ _ :: forall a. a -> a -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- const _ _ :: forall a b. a -> b -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- (=<<) _ _ :: forall (m :: * -> *) a b.
- Monad m =>
- (a -> m b) -> m a -> m b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- (.) _ _ :: forall b c a. (b -> c) -> (a -> b) -> a -> c
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- ($!) _ _ :: forall a b. (a -> b) -> a -> b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- uncurry _ _ :: forall a b c. (a -> b -> c) -> (a, b) -> c
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘Data.Tuple’))
- curry _ _ :: forall a b c. ((a, b) -> c) -> a -> b -> c
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘Data.Tuple’))
- (<*>) _ _ :: forall (f :: * -> *).
- Applicative f =>
- forall a b. f (a -> b) -> f a -> f b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- return _ :: forall (m :: * -> *). Monad m => forall a. a -> m a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- pure _ :: forall (f :: * -> *). Applicative f => forall a. a -> f a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- fmap _ _ :: forall (f :: * -> *).
- Functor f =>
- forall a b. (a -> b) -> f a -> f b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- (<$>) _ _ :: forall (f :: * -> *) a b.
- Functor f =>
- (a -> b) -> f a -> f b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘Data.Functor’))
- (>>) _ _ :: forall (m :: * -> *).
- Monad m =>
- forall a b. m a -> m b -> m b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- (*>) _ _ :: forall (f :: * -> *).
- Applicative f =>
- forall a b. f a -> f b -> f b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- (>>=) _ _ :: forall (m :: * -> *).
- Monad m =>
- forall a b. m a -> (a -> m b) -> m b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- fail _ :: forall (m :: * -> *). Monad m => forall a. String -> m a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- error _ :: forall a. GHC.Stack.Types.HasCallStack => [Char] -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Err’))
- errorWithoutStackTrace _ :: forall a. [Char] -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Err’))
- ($) _ :: forall a b. (a -> b) -> a -> b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- ($) _ _ :: forall a b. (a -> b) -> a -> b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- ($!) _ :: forall a b. (a -> b) -> a -> b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- id _ :: forall a. a -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- snd _ :: forall a b. (a, b) -> b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘Data.Tuple’))
- fst _ :: forall a b. (a, b) -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘Data.Tuple’))
- seq _ _ :: forall a b. a -> b -> b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Prim’))
-
-refinement_substitutions.hs:7:5: warning: [-Wtyped-holes (in -Wdefault)]
- • Found hole: _ :: Integer -> [Integer] -> Integer
- • In the expression: _
- In the expression: _ 0
- In an equation for ‘g’: g = _ 0
- • Relevant bindings include
- g :: [Integer] -> Integer
- (bound at refinement_substitutions.hs:7:1)
- Valid substitutions include
- const :: forall a b. a -> b -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- return :: forall (m :: * -> *). Monad m => forall a. a -> m a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- pure :: forall (f :: * -> *). Applicative f => forall a. a -> f a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Err’))
- Valid refinement substitutions include
- (<$) _ _ :: forall (f :: * -> *).
- Functor f =>
- forall a b. a -> f b -> f a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- (<*) _ _ :: forall (f :: * -> *).
- Applicative f =>
- forall a b. f a -> f b -> f a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- foldr _ :: forall (t :: * -> *).
- Foldable t =>
- forall a b. (a -> b -> b) -> b -> t a -> b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘Data.Foldable’))
- foldl _ :: forall (t :: * -> *).
- Foldable t =>
- forall b a. (b -> a -> b) -> b -> t a -> b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘Data.Foldable’))
- head _ :: forall a. [a] -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.List’))
- last _ :: forall a. [a] -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.List’))
- (!!) _ _ :: forall a. [a] -> Int -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.List’))
- flip _ :: forall a b c. (a -> b -> c) -> b -> a -> c
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- flip _ _ :: forall a b c. (a -> b -> c) -> b -> a -> c
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- const _ _ :: forall a b. a -> b -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- asTypeOf _ _ :: forall a. a -> a -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- const _ :: forall a b. a -> b -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- (=<<) _ _ :: forall (m :: * -> *) a b.
- Monad m =>
- (a -> m b) -> m a -> m b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- (.) _ _ :: forall b c a. (b -> c) -> (a -> b) -> a -> c
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- ($!) _ :: forall a b. (a -> b) -> a -> b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- uncurry _ _ :: forall a b c. (a -> b -> c) -> (a, b) -> c
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘Data.Tuple’))
- curry _ :: forall a b c. ((a, b) -> c) -> a -> b -> c
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘Data.Tuple’))
- curry _ _ :: forall a b c. ((a, b) -> c) -> a -> b -> c
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘Data.Tuple’))
- (<*>) _ _ :: forall (f :: * -> *).
- Applicative f =>
- forall a b. f (a -> b) -> f a -> f b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- return _ :: forall (m :: * -> *). Monad m => forall a. a -> m a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- pure _ :: forall (f :: * -> *). Applicative f => forall a. a -> f a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- fmap _ _ :: forall (f :: * -> *).
- Functor f =>
- forall a b. (a -> b) -> f a -> f b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- (<$>) _ _ :: forall (f :: * -> *) a b.
- Functor f =>
- (a -> b) -> f a -> f b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘Data.Functor’))
- (>>) _ _ :: forall (m :: * -> *).
- Monad m =>
- forall a b. m a -> m b -> m b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- (*>) _ _ :: forall (f :: * -> *).
- Applicative f =>
- forall a b. f a -> f b -> f b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- (>>=) _ _ :: forall (m :: * -> *).
- Monad m =>
- forall a b. m a -> (a -> m b) -> m b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- fail _ :: forall (m :: * -> *). Monad m => forall a. String -> m a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- error _ :: forall a. GHC.Stack.Types.HasCallStack => [Char] -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Err’))
- errorWithoutStackTrace _ :: forall a. [Char] -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Err’))
- ($) _ :: forall a b. (a -> b) -> a -> b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- ($) _ _ :: forall a b. (a -> b) -> a -> b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- ($!) _ _ :: forall a b. (a -> b) -> a -> b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- id _ :: forall a. a -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Base’))
- snd _ :: forall a b. (a, b) -> b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘Data.Tuple’))
- fst _ :: forall a b. (a, b) -> a
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘Data.Tuple’))
- seq _ _ :: forall a b. a -> b -> b
- (imported from ‘Prelude’ at refinement_substitutions.hs:1:8-30
- (and originally defined in ‘GHC.Prim’))
diff --git a/testsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.hs b/testsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.hs
new file mode 100755
index 0000000000..bda1b3de82
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.hs
@@ -0,0 +1,5 @@
+f :: [String]
+f = _ "hello, world"
+
+main :: IO ()
+main = return ()
diff --git a/testsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.stderr b/testsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.stderr
new file mode 100644
index 0000000000..bd2387f003
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.stderr
@@ -0,0 +1,39 @@
+
+subsumption_sort_hole_fits.hs:2:5: warning: [-Wtyped-holes (in -Wdefault)]
+ • 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 subsumption_sort_hole_fits.hs:2:1)
+ Valid hole fits include
+ lines :: String -> [String]
+ (imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1
+ (and originally defined in ‘base-4.12.0.0:Data.OldList’))
+ words :: String -> [String]
+ (imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1
+ (and originally defined in ‘base-4.12.0.0:Data.OldList’))
+ read :: forall a. Read a => String -> a
+ with read @[String]
+ (imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1
+ (and originally defined in ‘Text.Read’))
+ repeat :: forall a. a -> [a]
+ with repeat @String
+ (imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1
+ (and originally defined in ‘GHC.List’))
+ mempty :: forall a. Monoid a => a
+ with mempty @([Char] -> [String])
+ (imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1
+ (and originally defined in ‘GHC.Base’))
+ return :: forall (m :: * -> *). Monad m => forall a. a -> m a
+ with return @[] @String
+ (imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1
+ (and originally defined in ‘GHC.Base’))
+ pure :: forall (f :: * -> *). Applicative f => forall a. a -> f a
+ with pure @[] @String
+ (imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1
+ (and originally defined in ‘GHC.Base’))
+ fail :: forall (m :: * -> *). Monad m => forall a. String -> m a
+ with fail @[] @String
+ (imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1
+ (and originally defined in ‘GHC.Base’))
diff --git a/testsuite/tests/typecheck/should_compile/type_in_type_hole_fits.hs b/testsuite/tests/typecheck/should_compile/type_in_type_hole_fits.hs
new file mode 100644
index 0000000000..92d20daa56
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/type_in_type_hole_fits.hs
@@ -0,0 +1,88 @@
+{-# LANGUAGE TypeInType, TypeOperators, TypeFamilies,
+ UndecidableInstances, ConstraintKinds #-}
+module TypeInTypeSubstitutions where
+
+import GHC.TypeLits
+import Data.Type.Bool
+import Data.Type.Equality
+import Data.List (sort)
+
+
+-- We define a very simplistic O notation, with sufficient expressiveness
+-- to capture the complexity of a few simple sorting algorithms
+data AsympPoly = NLogN Nat Nat
+
+-- Synonyms for common terms
+type N = NLogN 1 0
+type LogN = NLogN 0 1
+type One = NLogN 0 0
+
+-- Just to be able to write it nicely
+type O (a :: AsympPoly) = a
+
+type family (^.) (n :: AsympPoly) (m :: Nat) :: AsympPoly where
+ (NLogN a b) ^. n = (NLogN (a * n) (b * n))
+
+type family (*.) (n :: AsympPoly) (m :: AsympPoly) :: AsympPoly where
+ (NLogN a b) *. (NLogN c d) = NLogN (a+c) (b+d)
+
+type family OCmp (n :: AsympPoly) (m :: AsympPoly) :: Ordering where
+ OCmp (NLogN a b) (NLogN c d) = If (CmpNat a c == EQ)
+ (CmpNat b d)
+ (CmpNat a c)
+
+type family OGEq (n :: AsympPoly) (m :: AsympPoly) :: Bool where
+ OGEq n m = Not (OCmp n m == 'LT)
+
+type (>=.) n m = OGEq n m ~ True
+
+infix 4 >=.
+infixl 7 *., ^.
+
+
+
+-- Stable sorts must be stable, but unstable can be, but don't need to.
+type IsStable s = (s || True) ~ True
+-- We encode in the return type of the sorting function its average complexity,
+-- memory use and stability.
+newtype Sorted (cpu :: AsympPoly) -- The minimum operational complexity
+ -- this algorithm satisfies.
+ (mem :: AsympPoly) -- The minimum space complexity this
+ -- algorithm satisfies.
+ (stable :: Bool) -- Whether the sort is stable or not.
+ a -- What was being sorted.
+ = Sorted {sortedBy :: [a]}
+
+-- Merge sort is O(N*Log(N)) on average in complexity, so that's the
+-- minimum complexity we promise to satisfy. Same goes with memory, which is
+-- O(N), and as we all know, mergesort is a stable sorting algoritm.
+mergeSort :: (Ord a, n >=. O(N*.LogN), m >=. O(N), IsStable s) =>
+ [a] -> Sorted n m s a
+mergeSort = Sorted . sort
+
+insertionSort :: (Ord a, n >=. O(N^.2), m >=. O(One), IsStable s) =>
+ [a] -> Sorted n m s a
+insertionSort = Sorted . sort
+
+-- Note that we don't actually check the complexity (as evidenced by them all
+-- being implemented with sort, a smooth applicative merge sort). With more
+-- dependent types however, some of these properties might be verifiable.
+quickSort :: (Ord a, n >=. O(N*.LogN), m >=. O(N)) => [a] -> Sorted n m False a
+quickSort = Sorted . sort
+
+heapSort :: (Ord a, n >=. O(N*.LogN), m >=. O(One)) => [a] -> Sorted n m False a
+heapSort = Sorted . sort
+
+-- Here we say that sorted can use at most operational complexity O(N^2), space
+-- complexity of at most (O(N)) and that it should be stable.
+mySortA :: Sorted (O(N^.2)) (O(N)) True Integer
+mySortA = _a [3,1,2]
+
+mySortB :: Sorted (O(N*.LogN)) (O(N)) False Integer
+mySortB = _b [3,1,2]
+
+mySortC :: Sorted (O(N*.LogN)) (O(One)) False Integer
+mySortC = _c [3,1,2]
+
+main :: IO ()
+main = print (sortedBy mySortA)
diff --git a/testsuite/tests/typecheck/should_compile/type_in_type_hole_fits.stderr b/testsuite/tests/typecheck/should_compile/type_in_type_hole_fits.stderr
new file mode 100644
index 0000000000..ec1b0dd4f1
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/type_in_type_hole_fits.stderr
@@ -0,0 +1,78 @@
+
+type_in_type_hole_fits.hs:79:11: warning: [-Wtyped-holes (in -Wdefault)]
+ • Found hole:
+ _a :: [Integer] -> Sorted (O ('NLogN 2 0)) (O N) 'True Integer
+ Or perhaps ‘_a’ is mis-spelled, or not in scope
+ • In the expression: _a
+ In the expression: _a [3, 1, 2]
+ In an equation for ‘mySortA’: mySortA = _a [3, 1, 2]
+ • Relevant bindings include
+ mySortA :: Sorted (O (N ^. 2)) (O N) 'True Integer
+ (bound at type_in_type_hole_fits.hs:79:1)
+ Valid hole fits include
+ mergeSort :: forall a (n :: AsympPoly) (m :: AsympPoly) (s :: Bool).
+ (Ord a, n >=. O (N *. LogN), m >=. O N, IsStable s) =>
+ [a] -> Sorted n m s a
+ with mergeSort @Integer @(O ('NLogN 2 0)) @(O N) @'True
+ (defined at type_in_type_hole_fits.hs:61:1)
+ insertionSort :: forall a (n :: AsympPoly) (m :: AsympPoly) (s :: Bool).
+ (Ord a, n >=. O (N ^. 2), m >=. O One, IsStable s) =>
+ [a] -> Sorted n m s a
+ with insertionSort @Integer @(O ('NLogN 2 0)) @(O N) @'True
+ (defined at type_in_type_hole_fits.hs:65:1)
+ Sorted :: forall (cpu :: AsympPoly) (mem :: AsympPoly) (stable :: Bool) a.
+ [a] -> Sorted cpu mem stable a
+ with Sorted @(O ('NLogN 2 0)) @(O N) @'True @Integer
+ (defined at type_in_type_hole_fits.hs:54:18)
+
+type_in_type_hole_fits.hs:82:11: warning: [-Wtyped-holes (in -Wdefault)]
+ • Found hole:
+ _b :: [Integer] -> Sorted (O ('NLogN 1 1)) (O N) 'False Integer
+ Or perhaps ‘_b’ is mis-spelled, or not in scope
+ • In the expression: _b
+ In the expression: _b [3, 1, 2]
+ In an equation for ‘mySortB’: mySortB = _b [3, 1, 2]
+ • Relevant bindings include
+ mySortB :: Sorted (O (N *. LogN)) (O N) 'False Integer
+ (bound at type_in_type_hole_fits.hs:82:1)
+ Valid hole fits include
+ quickSort :: forall a (n :: AsympPoly) (m :: AsympPoly).
+ (Ord a, n >=. O (N *. LogN), m >=. O N) =>
+ [a] -> Sorted n m 'False a
+ with quickSort @Integer @(O ('NLogN 1 1)) @(O N)
+ (defined at type_in_type_hole_fits.hs:71:1)
+ heapSort :: forall a (n :: AsympPoly) (m :: AsympPoly).
+ (Ord a, n >=. O (N *. LogN), m >=. O One) =>
+ [a] -> Sorted n m 'False a
+ with heapSort @Integer @(O ('NLogN 1 1)) @(O N)
+ (defined at type_in_type_hole_fits.hs:74:1)
+ mergeSort :: forall a (n :: AsympPoly) (m :: AsympPoly) (s :: Bool).
+ (Ord a, n >=. O (N *. LogN), m >=. O N, IsStable s) =>
+ [a] -> Sorted n m s a
+ with mergeSort @Integer @(O ('NLogN 1 1)) @(O N) @'False
+ (defined at type_in_type_hole_fits.hs:61:1)
+ Sorted :: forall (cpu :: AsympPoly) (mem :: AsympPoly) (stable :: Bool) a.
+ [a] -> Sorted cpu mem stable a
+ with Sorted @(O ('NLogN 1 1)) @(O N) @'False @Integer
+ (defined at type_in_type_hole_fits.hs:54:18)
+
+type_in_type_hole_fits.hs:85:11: warning: [-Wtyped-holes (in -Wdefault)]
+ • Found hole:
+ _c :: [Integer] -> Sorted (O ('NLogN 1 1)) (O One) 'False Integer
+ Or perhaps ‘_c’ is mis-spelled, or not in scope
+ • In the expression: _c
+ In the expression: _c [3, 1, 2]
+ In an equation for ‘mySortC’: mySortC = _c [3, 1, 2]
+ • Relevant bindings include
+ mySortC :: Sorted (O (N *. LogN)) (O One) 'False Integer
+ (bound at type_in_type_hole_fits.hs:85:1)
+ Valid hole fits include
+ heapSort :: forall a (n :: AsympPoly) (m :: AsympPoly).
+ (Ord a, n >=. O (N *. LogN), m >=. O One) =>
+ [a] -> Sorted n m 'False a
+ with heapSort @Integer @(O ('NLogN 1 1)) @(O One)
+ (defined at type_in_type_hole_fits.hs:74:1)
+ Sorted :: forall (cpu :: AsympPoly) (mem :: AsympPoly) (stable :: Bool) a.
+ [a] -> Sorted cpu mem stable a
+ with Sorted @(O ('NLogN 1 1)) @(O One) @'False @Integer
+ (defined at type_in_type_hole_fits.hs:54:18)
diff --git a/testsuite/tests/typecheck/should_compile/valid_substitutions.hs b/testsuite/tests/typecheck/should_compile/valid_hole_fits.hs
index 646bc0ab57..39939ba692 100644
--- a/testsuite/tests/typecheck/should_compile/valid_substitutions.hs
+++ b/testsuite/tests/typecheck/should_compile/valid_hole_fits.hs
@@ -3,7 +3,7 @@ module Foo where
import Prelude hiding (putStr, putStrLn)
import qualified System.IO (putStr, putStrLn)
import Data.Maybe
-import qualified ValidSubs
+import qualified ValidHoleFits
ps :: String -> IO ()
ps = putStrLn
@@ -20,7 +20,7 @@ c _ = do { x <- a 0
test :: [Maybe a] -> [a]
test = _
-test2 :: Integer -> ValidSubs.Moo
+test2 :: Integer -> ValidHoleFits.Moo
test2 = _
k :: Maybe Integer
diff --git a/testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr b/testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr
new file mode 100644
index 0000000000..a87bea1268
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr
@@ -0,0 +1,255 @@
+[1 of 2] Compiling ValidHoleFits ( ValidHoleFits.hs, ValidHoleFits.o )
+[2 of 2] Compiling Foo ( valid_hole_fits.hs, valid_hole_fits.o )
+
+valid_hole_fits.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_hole_fits.hs:3:1-40).
+
+valid_hole_fits.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_hole_fits.hs:16:12)
+ c :: Int -> IO Int (bound at valid_hole_fits.hs:16:1)
+ Valid hole fits include
+ c :: Int -> IO Int (bound at valid_hole_fits.hs:16:1)
+ a :: Int -> IO Int (bound at valid_hole_fits.hs:12:1)
+ b :: Int -> IO Int (bound at valid_hole_fits.hs:14:1)
+ return :: forall (m :: * -> *). Monad m => forall a. a -> m a
+ with return @IO @Int
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.Base’))
+ pure :: forall (f :: * -> *). Applicative f => forall a. a -> f a
+ with pure @IO @Int
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.Base’))
+
+valid_hole_fits.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_hole_fits.hs:20:1-24
+ • In the expression: _
+ In an equation for ‘test’: test = _
+ • Relevant bindings include
+ test :: [Maybe a] -> [a] (bound at valid_hole_fits.hs:21:1)
+ Valid hole fits include
+ test :: [Maybe a] -> [a] (bound at valid_hole_fits.hs:21:1)
+ catMaybes :: forall a. [Maybe a] -> [a]
+ with catMaybes @a
+ (imported from ‘Data.Maybe’ at valid_hole_fits.hs:5:1-17)
+ mempty :: forall a. Monoid a => a
+ with mempty @([Maybe a] -> [a])
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.Base’))
+
+valid_hole_fits.hs:24:9: warning: [-Wtyped-holes (in -Wdefault)]
+ • Found hole: _ :: Integer -> ValidHoleFits.Moo
+ • In the expression: _
+ In an equation for ‘test2’: test2 = _
+ • Relevant bindings include
+ test2 :: Integer -> ValidHoleFits.Moo
+ (bound at valid_hole_fits.hs:24:1)
+ Valid hole fits include
+ test2 :: Integer -> ValidHoleFits.Moo
+ (bound at valid_hole_fits.hs:24:1)
+ ValidHoleFits.Moo :: Integer -> ValidHoleFits.Moo
+ (imported qualified from ‘ValidHoleFits’ at valid_hole_fits.hs:6:1-30
+ (and originally defined at ValidHoleFits.hs:4:12-22))
+
+valid_hole_fits.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_hole_fits.hs:27:1)
+ Valid hole fits include
+ Just :: forall a. a -> Maybe a
+ with Just @Integer
+ (imported from ‘Data.Maybe’ at valid_hole_fits.hs:5:1-17
+ (and originally defined in ‘GHC.Base’))
+ return :: forall (m :: * -> *). Monad m => forall a. a -> m a
+ with return @Maybe @Integer
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.Base’))
+ pure :: forall (f :: * -> *). Applicative f => forall a. a -> f a
+ with pure @Maybe @Integer
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.Base’))
+
+valid_hole_fits.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 68 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_hole_fits.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_hole_fits.hs:30:1)
+ Valid hole fits include
+ f :: String (bound at valid_hole_fits.hs:30:1)
+ k :: Maybe Integer (defined at valid_hole_fits.hs:27:1)
+ h :: String (bound at valid_hole_fits.hs:34:1)
+ otherwise :: Bool
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.Base’))
+ False :: Bool
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.Types’))
+ True :: Bool
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.Types’))
+ EQ :: Ordering
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.Types’))
+ LT :: Ordering
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.Types’))
+ GT :: Ordering
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.Types’))
+ pi :: forall a. Floating a => a
+ with pi @Double
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.Float’))
+
+valid_hole_fits.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 68 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_hole_fits.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_hole_fits.hs:34:1)
+ Valid hole fits include
+ not :: Bool -> Bool
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.Classes’))
+ enumFrom :: forall a. Enum a => a -> [a]
+ with enumFrom @Bool
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.Enum’))
+ Just :: forall a. a -> Maybe a
+ with Just @Bool
+ (imported from ‘Data.Maybe’ at valid_hole_fits.hs:5:1-17
+ (and originally defined in ‘GHC.Base’))
+ id :: forall a. a -> a
+ with id @Bool
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.Base’))
+ repeat :: forall a. a -> [a]
+ with repeat @Bool
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.List’))
+ fromEnum :: forall a. Enum a => a -> Int
+ with fromEnum @Bool
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.Enum’))
+ pred :: forall a. Enum a => a -> a
+ with pred @Bool
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.Enum’))
+ succ :: forall a. Enum a => a -> a
+ with succ @Bool
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.Enum’))
+ show :: forall a. Show a => a -> String
+ with show @Bool
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.Show’))
+
+valid_hole_fits.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_hole_fits.hs:34:1)
+ Valid hole fits include
+ otherwise :: Bool
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.Base’))
+ False :: Bool
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.Types’))
+ True :: Bool
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.Types’))
+ maxBound :: forall a. Bounded a => a
+ with maxBound @Bool
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.Enum’))
+ minBound :: forall a. Bounded a => a
+ with minBound @Bool
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.Enum’))
+
+valid_hole_fits.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_hole_fits.hs:37:1)
+ Valid hole fits include
+ ps :: String -> IO () (defined at valid_hole_fits.hs:9:1)
+ System.IO.putStr :: String -> IO ()
+ (imported qualified from ‘System.IO’ at valid_hole_fits.hs:4:29-34)
+ System.IO.putStrLn :: String -> IO ()
+ (imported qualified from ‘System.IO’ at valid_hole_fits.hs:4:37-44)
+ readIO :: forall a. Read a => String -> IO a
+ with readIO @()
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘System.IO’))
+ print :: forall a. Show a => a -> IO ()
+ with print @[Char]
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘System.IO’))
+ fail :: forall (m :: * -> *). Monad m => forall a. String -> m a
+ with fail @IO @()
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.Base’))
+ mempty :: forall a. Monoid a => a
+ with mempty @([Char] -> IO ())
+ (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
+ (and originally defined in ‘GHC.Base’))
diff --git a/testsuite/tests/typecheck/should_compile/valid_substitutions_interactions.hs b/testsuite/tests/typecheck/should_compile/valid_hole_fits_interactions.hs
index a2186e73a3..a2186e73a3 100644
--- a/testsuite/tests/typecheck/should_compile/valid_substitutions_interactions.hs
+++ b/testsuite/tests/typecheck/should_compile/valid_hole_fits_interactions.hs
diff --git a/testsuite/tests/typecheck/should_compile/valid_hole_fits_interactions.stderr b/testsuite/tests/typecheck/should_compile/valid_hole_fits_interactions.stderr
new file mode 100644
index 0000000000..ac4fdc94c7
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/valid_hole_fits_interactions.stderr
@@ -0,0 +1,11 @@
+
+valid_hole_fits_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_hole_fits_interactions.hs:15:1)
+ Valid hole fits include
+ f :: SBool 'True (bound at valid_hole_fits_interactions.hs:15:1)
+ STrue :: SBool 'True
+ (defined at valid_hole_fits_interactions.hs:12:3)
diff --git a/testsuite/tests/typecheck/should_compile/valid_substitutions.stderr b/testsuite/tests/typecheck/should_compile/valid_substitutions.stderr
deleted file mode 100644
index 978110f956..0000000000
--- a/testsuite/tests/typecheck/should_compile/valid_substitutions.stderr
+++ /dev/null
@@ -1,258 +0,0 @@
-[1 of 2] Compiling ValidSubs ( ValidSubs.hs, ValidSubs.o )
-[2 of 2] Compiling Foo ( valid_substitutions.hs, valid_substitutions.o )
-
-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)
- 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’))
- 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’))
- undefined :: forall a. 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:20:1-24
- • In the expression: _
- In an equation for ‘test’: test = _
- • Relevant bindings include
- 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)
- catMaybes :: forall a. [Maybe a] -> [a]
- (imported from ‘Data.Maybe’ at valid_substitutions.hs:5:1-17)
- mempty :: forall a. Monoid a => a
- (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
- (and originally defined in ‘GHC.Base’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
- (and originally defined in ‘GHC.Err’))
-
-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: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. 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’))
- 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’))
- 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’))
- undefined :: forall a. 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 68 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
- f :: String (defined at valid_substitutions.hs:30:1)
- h :: String (defined at valid_substitutions.hs:34:1)
- k :: Maybe Integer (defined at valid_substitutions.hs:27:1)
- EQ :: Ordering
- (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’))
- GT :: Ordering
- (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
- (and originally defined in ‘GHC.Types’))
- pi :: forall a. Floating a => a
- (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
- (and originally defined in ‘GHC.Float’))
- otherwise :: Bool
- (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
- (and originally defined in ‘GHC.Base’))
- 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’))
-
-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 68 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
- show :: forall a. Show a => a -> String
- (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
- (and originally defined in ‘GHC.Show’))
- fromEnum :: forall a. Enum a => a -> Int
- (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
- (and originally defined in ‘GHC.Enum’))
- not :: Bool -> Bool
- (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
- (and originally defined in ‘GHC.Classes’))
- 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’))
- id :: forall a. a -> a
- (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
- (and originally defined in ‘GHC.Base’))
- Just :: forall a. a -> Maybe a
- (imported from ‘Data.Maybe’ at valid_substitutions.hs:5:1-17
- (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’))
- repeat :: forall a. a -> [a]
- (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
- (and originally defined in ‘GHC.List’))
-
-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
- otherwise :: Bool
- (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
- (and originally defined in ‘GHC.Base’))
- 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’))
- 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. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
- (and originally defined in ‘GHC.Err’))
-
-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: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:29-34)
- System.IO.putStrLn :: String -> IO ()
- (imported qualified from ‘System.IO’ at valid_substitutions.hs:4:37-44)
- readIO :: forall a. Read a => String -> IO a
- (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
- (and originally defined in ‘System.IO’))
- fail :: forall (m :: * -> *). Monad m => forall a. String -> m a
- (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
- (and originally defined in ‘GHC.Base’))
- error :: forall a. GHC.Stack.Types.HasCallStack => [Char] -> a
- (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
- (and originally defined in ‘GHC.Err’))
- errorWithoutStackTrace :: forall a. [Char] -> a
- (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
- (and originally defined in ‘GHC.Err’))
- print :: forall a. Show a => a -> IO ()
- (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
- (and originally defined in ‘System.IO’))
- mempty :: forall a. Monoid a => a
- (imported from ‘Prelude’ at valid_substitutions.hs:3:1-40
- (and originally defined in ‘GHC.Base’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (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.stderr b/testsuite/tests/typecheck/should_compile/valid_substitutions_interactions.stderr
deleted file mode 100644
index 878309a3cf..0000000000
--- a/testsuite/tests/typecheck/should_compile/valid_substitutions_interactions.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-
-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
- f :: SBool 'True
- (defined at valid_substitutions_interactions.hs:15:1)
- STrue :: SBool 'True
- (defined at valid_substitutions_interactions.hs:12:3)
- undefined :: forall a. 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/T12177.stderr b/testsuite/tests/typecheck/should_fail/T12177.stderr
index dee9117d05..0c810f4185 100644
--- a/testsuite/tests/typecheck/should_fail/T12177.stderr
+++ b/testsuite/tests/typecheck/should_fail/T12177.stderr
@@ -10,10 +10,6 @@ T12177.hs:3:19: error:
• Relevant bindings include
x :: p1 (bound at T12177.hs:3:14)
bar :: p -> p1 -> t (bound at T12177.hs:3:1)
- Valid substitutions include
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at T12177.hs:1:8-10
- (and originally defined in ‘GHC.Err’))
T12177.hs:5:37: error:
• Found hole: _ :: t
@@ -28,7 +24,3 @@ T12177.hs:5:37: error:
x :: p3 (bound at T12177.hs:5:26)
y :: p1 (bound at T12177.hs:5:14)
baz :: p -> p1 -> p2 -> p3 -> p4 -> t (bound at T12177.hs:5:1)
- Valid substitutions include
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at T12177.hs:1:8-10
- (and originally defined in ‘GHC.Err’))
diff --git a/testsuite/tests/typecheck/should_fail/T14884.stderr b/testsuite/tests/typecheck/should_fail/T14884.stderr
index 39c3a71a73..11008b316a 100644
--- a/testsuite/tests/typecheck/should_fail/T14884.stderr
+++ b/testsuite/tests/typecheck/should_fail/T14884.stderr
@@ -6,24 +6,29 @@ T14884.hs:4:5: error:
In the expression: _ print "abc"
In an equation for ‘x’: x = _ print "abc"
• Relevant bindings include x :: IO () (bound at T14884.hs:4:1)
- Valid substitutions include
- foldMap :: forall (t :: * -> *).
- Foldable t =>
- forall m a. Monoid m => (a -> m) -> t a -> m
- (imported from ‘Prelude’ at T14884.hs:1:8-13
- (and originally defined in ‘Data.Foldable’))
+ Valid hole fits include
mapM_ :: forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
+ with mapM_ @[] @IO @Char @()
+ (imported from ‘Prelude’ at T14884.hs:1:8-13
+ (and originally defined in ‘Data.Foldable’))
+ foldMap :: forall (t :: * -> *).
+ Foldable t =>
+ forall m a. Monoid m => (a -> m) -> t a -> m
+ with foldMap @[] @(IO ()) @Char
(imported from ‘Prelude’ at T14884.hs:1:8-13
(and originally defined in ‘Data.Foldable’))
($) :: forall a b. (a -> b) -> a -> b
+ with ($) @'GHC.Types.LiftedRep @[Char] @(IO ())
(imported from ‘Prelude’ at T14884.hs:1:8-13
(and originally defined in ‘GHC.Base’))
($!) :: forall a b. (a -> b) -> a -> b
+ with ($!) @'GHC.Types.LiftedRep @[Char] @(IO ())
(imported from ‘Prelude’ at T14884.hs:1:8-13
(and originally defined in ‘GHC.Base’))
id :: forall a. a -> a
+ with id @([Char] -> IO ())
(imported from ‘Prelude’ at T14884.hs:1:8-13
(and originally defined in ‘GHC.Base’))
diff --git a/testsuite/tests/typecheck/should_fail/T9497d.stderr b/testsuite/tests/typecheck/should_fail/T9497d.stderr
index 1ae8ec0e05..fff9e2e6a8 100644
--- a/testsuite/tests/typecheck/should_fail/T9497d.stderr
+++ b/testsuite/tests/typecheck/should_fail/T9497d.stderr
@@ -5,14 +5,13 @@ T9497d.hs:2:8: error:
• In the expression: _main
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)
+ Valid hole fits include
+ main :: IO () (bound at T9497d.hs:2:1)
readLn :: forall a. Read a => IO a
+ with readLn @()
(imported from ‘Prelude’ at T9497d.hs:1:1
(and originally defined in ‘System.IO’))
mempty :: forall a. Monoid a => a
+ with mempty @(IO ())
(imported from ‘Prelude’ at T9497d.hs:1:1
(and originally defined in ‘GHC.Base’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at T9497d.hs:1:1
- (and originally defined in ‘GHC.Err’))
diff --git a/testsuite/tests/typecheck/should_run/T9497a-run.stderr b/testsuite/tests/typecheck/should_run/T9497a-run.stderr
index 2f5097e978..6461d98b10 100644
--- a/testsuite/tests/typecheck/should_run/T9497a-run.stderr
+++ b/testsuite/tests/typecheck/should_run/T9497a-run.stderr
@@ -5,15 +5,14 @@ T9497a-run: T9497a-run.hs:2:8: error:
In an equation for ‘main’: main = _main
• Relevant bindings include
main :: IO () (bound at T9497a-run.hs:2:1)
- Valid substitutions include
- main :: IO () (defined at T9497a-run.hs:2:1)
+ Valid hole fits include
+ main :: IO () (bound at T9497a-run.hs:2:1)
readLn :: forall a. Read a => IO a
+ with readLn @()
(imported from ‘Prelude’ at T9497a-run.hs:1:1
(and originally defined in ‘System.IO’))
mempty :: forall a. Monoid a => a
+ with mempty @(IO ())
(imported from ‘Prelude’ at T9497a-run.hs:1:1
(and originally defined in ‘GHC.Base’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at T9497a-run.hs:1:1
- (and originally defined in ‘GHC.Err’))
(deferred type error)
diff --git a/testsuite/tests/typecheck/should_run/T9497b-run.stderr b/testsuite/tests/typecheck/should_run/T9497b-run.stderr
index e5a1bafce3..a73b71981c 100644
--- a/testsuite/tests/typecheck/should_run/T9497b-run.stderr
+++ b/testsuite/tests/typecheck/should_run/T9497b-run.stderr
@@ -5,15 +5,14 @@ T9497b-run: T9497b-run.hs:2:8: error:
In an equation for ‘main’: main = _main
• Relevant bindings include
main :: IO () (bound at T9497b-run.hs:2:1)
- Valid substitutions include
- main :: IO () (defined at T9497b-run.hs:2:1)
+ Valid hole fits include
+ main :: IO () (bound at T9497b-run.hs:2:1)
readLn :: forall a. Read a => IO a
+ with readLn @()
(imported from ‘Prelude’ at T9497b-run.hs:1:1
(and originally defined in ‘System.IO’))
mempty :: forall a. Monoid a => a
+ with mempty @(IO ())
(imported from ‘Prelude’ at T9497b-run.hs:1:1
(and originally defined in ‘GHC.Base’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at T9497b-run.hs:1:1
- (and originally defined in ‘GHC.Err’))
(deferred type error)
diff --git a/testsuite/tests/typecheck/should_run/T9497c-run.stderr b/testsuite/tests/typecheck/should_run/T9497c-run.stderr
index 4605857af5..8666900b4e 100644
--- a/testsuite/tests/typecheck/should_run/T9497c-run.stderr
+++ b/testsuite/tests/typecheck/should_run/T9497c-run.stderr
@@ -5,15 +5,14 @@ T9497c-run: T9497c-run.hs:2:8: error:
In an equation for ‘main’: main = _main
• Relevant bindings include
main :: IO () (bound at T9497c-run.hs:2:1)
- Valid substitutions include
- main :: IO () (defined at T9497c-run.hs:2:1)
+ Valid hole fits include
+ main :: IO () (bound at T9497c-run.hs:2:1)
readLn :: forall a. Read a => IO a
+ with readLn @()
(imported from ‘Prelude’ at T9497c-run.hs:1:1
(and originally defined in ‘System.IO’))
mempty :: forall a. Monoid a => a
+ with mempty @(IO ())
(imported from ‘Prelude’ at T9497c-run.hs:1:1
(and originally defined in ‘GHC.Base’))
- undefined :: forall a. GHC.Stack.Types.HasCallStack => a
- (imported from ‘Prelude’ at T9497c-run.hs:1:1
- (and originally defined in ‘GHC.Err’))
(deferred type error)