summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-11-07 17:24:47 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-11-19 11:53:55 -0500
commit08d595c026f0774c51d85cbd790518055970ff2d (patch)
tree706d776534998f69ed8cb62e3befa471bf4fdfdd
parenta8adb5b4d782b6166160a80adbf6c59452dc964d (diff)
downloadhaskell-08d595c026f0774c51d85cbd790518055970ff2d.tar.gz
Give seq a more precise type and remove magic
`GHC.Prim.seq` previously had the rather plain type: seq :: forall a b. a -> b -> b However, it also had a special typing rule to applications where `b` is not of kind `Type`. Issue #17440 noted that levity polymorphism allows us to rather give it the more precise type: seq :: forall (r :: RuntimeRep) a (b :: TYPE r). a -> b -> b This allows us to remove the special typing rule that we previously required to allow applications on unlifted arguments. T9404 contains a non-Type application of `seq` which should verify that this works as expected. Closes #17440.
-rw-r--r--compiler/basicTypes/MkId.hs39
-rw-r--r--compiler/deSugar/DsUtils.hs142
-rw-r--r--compiler/simplCore/Simplify.hs9
-rw-r--r--compiler/typecheck/TcExpr.hs50
-rw-r--r--testsuite/tests/simplCore/should_run/SeqRule.hs2
-rw-r--r--testsuite/tests/typecheck/should_compile/T13050.stderr24
-rw-r--r--testsuite/tests/typecheck/should_compile/T14590.stderr32
-rw-r--r--testsuite/tests/typecheck/should_compile/abstract_refinement_hole_fits.stderr8
-rw-r--r--testsuite/tests/typecheck/should_compile/holes.stderr2
-rw-r--r--testsuite/tests/typecheck/should_compile/holes3.stderr2
-rw-r--r--testsuite/tests/warnings/should_compile/PluralS.stderr2
11 files changed, 142 insertions, 170 deletions
diff --git a/compiler/basicTypes/MkId.hs b/compiler/basicTypes/MkId.hs
index d9d23b1235..593f9ac3a9 100644
--- a/compiler/basicTypes/MkId.hs
+++ b/compiler/basicTypes/MkId.hs
@@ -1392,7 +1392,6 @@ seqId = pcMiscPrelId seqName ty info
where
info = noCafIdInfo `setInlinePragInfo` inline_prag
`setUnfoldingInfo` mkCompulsoryUnfolding rhs
- `setNeverLevPoly` ty
inline_prag
= alwaysInlinePragma `setInlinePragmaActivation` ActiveAfter
@@ -1402,11 +1401,15 @@ seqId = pcMiscPrelId seqName ty info
-- LHS of rules. That way we can have rules for 'seq';
-- see Note [seqId magic]
- ty = mkSpecForAllTys [alphaTyVar,betaTyVar]
- (mkVisFunTy alphaTy (mkVisFunTy betaTy betaTy))
+ -- seq :: forall (r :: RuntimeRep) a (b :: TYPE r). a -> b -> b
+ ty =
+ mkInvForAllTy runtimeRep2TyVar
+ $ mkSpecForAllTys [alphaTyVar, openBetaTyVar]
+ $ mkVisFunTy alphaTy (mkVisFunTy openBetaTy openBetaTy)
- [x,y] = mkTemplateLocals [alphaTy, betaTy]
- rhs = mkLams [alphaTyVar,betaTyVar,x,y] (Case (Var x) x betaTy [(DEFAULT, [], Var y)])
+ [x,y] = mkTemplateLocals [alphaTy, openBetaTy]
+ rhs = mkLams ([runtimeRep2TyVar, alphaTyVar, openBetaTyVar, x, y]) $
+ Case (Var x) x openBetaTy [(DEFAULT, [], Var y)]
------------------------------------------------
lazyId :: Id -- See Note [lazyId magic]
@@ -1492,19 +1495,20 @@ Note [seqId magic]
~~~~~~~~~~~~~~~~~~
'GHC.Prim.seq' is special in several ways.
-a) In source Haskell its second arg can have an unboxed type
- x `seq` (v +# w)
- But see Note [Typing rule for seq] in TcExpr, which
- explains why we give seq itself an ordinary type
- seq :: forall a b. a -> b -> b
- and treat it as a language construct from a typing point of view.
+a) Its fixity is set in LoadIface.ghcPrimIface
-b) Its fixity is set in LoadIface.ghcPrimIface
-
-c) It has quite a bit of desugaring magic.
+b) It has quite a bit of desugaring magic.
See DsUtils.hs Note [Desugaring seq (1)] and (2) and (3)
-d) There is some special rule handing: Note [User-defined RULES for seq]
+c) There is some special rule handing: Note [User-defined RULES for seq]
+
+Historical note:
+ In TcExpr we used to need a special typing rule for 'seq', to handle calls
+ whose second argument had an unboxed type, e.g. x `seq` 3#
+
+ However, with levity polymorphism we can now give seq the type seq ::
+ forall (r :: RuntimeRep) a (b :: TYPE r). a -> b -> b which handles this
+ case without special treatment in the typechecker.
Note [User-defined RULES for seq]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1530,13 +1534,16 @@ If we wrote
RULE "f/seq" forall n e. seq (f n) e = seq n e
with rule arity 2, then two bad things would happen:
- - The magical desugaring done in Note [seqId magic] item (c)
+ - The magical desugaring done in Note [seqId magic] item (b)
for saturated application of 'seq' would turn the LHS into
a case expression!
- The code in Simplify.rebuildCase would need to actually supply
the value argument, which turns out to be awkward.
+See also: Note [User-defined RULES for seq] in Simplify.
+
+
Note [lazyId magic]
~~~~~~~~~~~~~~~~~~~
lazy :: forall a?. a? -> a? (i.e. works for unboxed types too)
diff --git a/compiler/deSugar/DsUtils.hs b/compiler/deSugar/DsUtils.hs
index 8559e9ae85..b76c4f0592 100644
--- a/compiler/deSugar/DsUtils.hs
+++ b/compiler/deSugar/DsUtils.hs
@@ -408,82 +408,88 @@ mkErrorAppDs err_id ty msg = do
return (mkApps (Var err_id) [Type (getRuntimeRep ty), Type ty, core_msg])
{-
-'mkCoreAppDs' and 'mkCoreAppsDs' hand the special-case desugaring of 'seq'.
-
-Note [Desugaring seq (1)] cf #1031
-~~~~~~~~~~~~~~~~~~~~~~~~~
- f x y = x `seq` (y `seq` (# x,y #))
-
-The [CoreSyn let/app invariant] means that, other things being equal, because
-the argument to the outer 'seq' has an unlifted type, we'll use call-by-value thus:
-
- f x y = case (y `seq` (# x,y #)) of v -> x `seq` v
-
-But that is bad for two reasons:
- (a) we now evaluate y before x, and
- (b) we can't bind v to an unboxed pair
-
-Seq is very, very special! So we recognise it right here, and desugar to
- case x of _ -> case y of _ -> (# x,y #)
-
-Note [Desugaring seq (2)] cf #2273
-~~~~~~~~~~~~~~~~~~~~~~~~~
-Consider
- let chp = case b of { True -> fst x; False -> 0 }
- in chp `seq` ...chp...
-Here the seq is designed to plug the space leak of retaining (snd x)
-for too long.
-
-If we rely on the ordinary inlining of seq, we'll get
- let chp = case b of { True -> fst x; False -> 0 }
- case chp of _ { I# -> ...chp... }
-
-But since chp is cheap, and the case is an alluring contet, we'll
-inline chp into the case scrutinee. Now there is only one use of chp,
-so we'll inline a second copy. Alas, we've now ruined the purpose of
-the seq, by re-introducing the space leak:
- case (case b of {True -> fst x; False -> 0}) of
- I# _ -> ...case b of {True -> fst x; False -> 0}...
-
-We can try to avoid doing this by ensuring that the binder-swap in the
-case happens, so we get his at an early stage:
- case chp of chp2 { I# -> ...chp2... }
-But this is fragile. The real culprit is the source program. Perhaps we
-should have said explicitly
- let !chp2 = chp in ...chp2...
-
-But that's painful. So the code here does a little hack to make seq
-more robust: a saturated application of 'seq' is turned *directly* into
-the case expression, thus:
- x `seq` e2 ==> case x of x -> e2 -- Note shadowing!
- e1 `seq` e2 ==> case x of _ -> e2
-
-So we desugar our example to:
- let chp = case b of { True -> fst x; False -> 0 }
- case chp of chp { I# -> ...chp... }
-And now all is well.
-
-The reason it's a hack is because if you define mySeq=seq, the hack
-won't work on mySeq.
-
-Note [Desugaring seq (3)] cf #2409
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The isLocalId ensures that we don't turn
- True `seq` e
-into
- case True of True { ... }
-which stupidly tries to bind the datacon 'True'.
+'mkCoreAppDs' and 'mkCoreAppsDs' handle the special-case desugaring of 'seq'.
+
+Note [Desugaring seq]
+~~~~~~~~~~~~~~~~~~~~~
+
+There are a few subtleties in the desugaring of `seq`:
+
+ 1. (as described in #1031)
+
+ Consider,
+ f x y = x `seq` (y `seq` (# x,y #))
+
+ The [CoreSyn let/app invariant] means that, other things being equal, because
+ the argument to the outer 'seq' has an unlifted type, we'll use call-by-value thus:
+
+ f x y = case (y `seq` (# x,y #)) of v -> x `seq` v
+
+ But that is bad for two reasons:
+ (a) we now evaluate y before x, and
+ (b) we can't bind v to an unboxed pair
+
+ Seq is very, very special! So we recognise it right here, and desugar to
+ case x of _ -> case y of _ -> (# x,y #)
+
+ 2. (as described in #2273)
+
+ Consider
+ let chp = case b of { True -> fst x; False -> 0 }
+ in chp `seq` ...chp...
+ Here the seq is designed to plug the space leak of retaining (snd x)
+ for too long.
+
+ If we rely on the ordinary inlining of seq, we'll get
+ let chp = case b of { True -> fst x; False -> 0 }
+ case chp of _ { I# -> ...chp... }
+
+ But since chp is cheap, and the case is an alluring contet, we'll
+ inline chp into the case scrutinee. Now there is only one use of chp,
+ so we'll inline a second copy. Alas, we've now ruined the purpose of
+ the seq, by re-introducing the space leak:
+ case (case b of {True -> fst x; False -> 0}) of
+ I# _ -> ...case b of {True -> fst x; False -> 0}...
+
+ We can try to avoid doing this by ensuring that the binder-swap in the
+ case happens, so we get his at an early stage:
+ case chp of chp2 { I# -> ...chp2... }
+ But this is fragile. The real culprit is the source program. Perhaps we
+ should have said explicitly
+ let !chp2 = chp in ...chp2...
+
+ But that's painful. So the code here does a little hack to make seq
+ more robust: a saturated application of 'seq' is turned *directly* into
+ the case expression, thus:
+ x `seq` e2 ==> case x of x -> e2 -- Note shadowing!
+ e1 `seq` e2 ==> case x of _ -> e2
+
+ So we desugar our example to:
+ let chp = case b of { True -> fst x; False -> 0 }
+ case chp of chp { I# -> ...chp... }
+ And now all is well.
+
+ The reason it's a hack is because if you define mySeq=seq, the hack
+ won't work on mySeq.
+
+ 3. (as described in #2409)
+
+ The isLocalId ensures that we don't turn
+ True `seq` e
+ into
+ case True of True { ... }
+ which stupidly tries to bind the datacon 'True'.
-}
-- NB: Make sure the argument is not levity polymorphic
mkCoreAppDs :: SDoc -> CoreExpr -> CoreExpr -> CoreExpr
-mkCoreAppDs _ (Var f `App` Type ty1 `App` Type ty2 `App` arg1) arg2
- | f `hasKey` seqIdKey -- Note [Desugaring seq (1), (2)]
+mkCoreAppDs _ (Var f `App` Type _r `App` Type ty1 `App` Type ty2 `App` arg1) arg2
+ | f `hasKey` seqIdKey -- Note [Desugaring seq], points (1) and (2)
= Case arg1 case_bndr ty2 [(DEFAULT,[],arg2)]
where
case_bndr = case arg1 of
Var v1 | isInternalName (idName v1)
- -> v1 -- Note [Desugaring seq (2) and (3)]
+ -> v1 -- Note [Desugaring seq], points (2) and (3)
_ -> mkWildValBinder ty1
mkCoreAppDs s fun arg = mkCoreApp s fun arg -- The rest is done in MkCore
diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs
index 795b0f5654..569bcfd3dc 100644
--- a/compiler/simplCore/Simplify.hs
+++ b/compiler/simplCore/Simplify.hs
@@ -2090,11 +2090,16 @@ trySeqRules in_env scrut rhs cont
no_cast_scrut = drop_casts scrut
scrut_ty = exprType no_cast_scrut
seq_id_ty = idType seqId
+ res1_ty = piResultTy seq_id_ty rhs_rep
+ res2_ty = piResultTy res1_ty scrut_ty
rhs_ty = substTy in_env (exprType rhs)
- out_args = [ TyArg { as_arg_ty = scrut_ty
+ rhs_rep = getRuntimeRep rhs_ty
+ out_args = [ TyArg { as_arg_ty = rhs_rep
, as_hole_ty = seq_id_ty }
+ , TyArg { as_arg_ty = scrut_ty
+ , as_hole_ty = res1_ty }
, TyArg { as_arg_ty = rhs_ty
- , as_hole_ty = piResultTy seq_id_ty scrut_ty }
+ , as_hole_ty = res2_ty }
, ValArg no_cast_scrut]
rule_cont = ApplyToVal { sc_dup = NoDup, sc_arg = rhs
, sc_env = in_env, sc_cont = cont }
diff --git a/compiler/typecheck/TcExpr.hs b/compiler/typecheck/TcExpr.hs
index b7a6779325..c7921070f6 100644
--- a/compiler/typecheck/TcExpr.hs
+++ b/compiler/typecheck/TcExpr.hs
@@ -63,9 +63,8 @@ import TyCoSubst (substTyWithInScope)
import Type
import TcEvidence
import VarSet
-import MkId( seqId )
import TysWiredIn
-import TysPrim( intPrimTy, mkTemplateTyVars, tYPE )
+import TysPrim( intPrimTy )
import PrimOp( tagToEnumKey )
import PrelNames
import DynFlags
@@ -335,40 +334,10 @@ rule just for saturated applications of ($).
* Decompose it; should be of form (arg2_ty -> res_ty),
where arg2_ty might be a polytype
* Use arg2_ty to typecheck arg2
-
-Note [Typing rule for seq]
-~~~~~~~~~~~~~~~~~~~~~~~~~~
-We want to allow
- x `seq` (# p,q #)
-which suggests this type for seq:
- seq :: forall (a:*) (b:Open). a -> b -> b,
-with (b:Open) meaning that be can be instantiated with an unboxed
-tuple. The trouble is that this might accept a partially-applied
-'seq', and I'm just not certain that would work. I'm only sure it's
-only going to work when it's fully applied, so it turns into
- case x of _ -> (# p,q #)
-
-So it seems more uniform to treat 'seq' as if it was a language
-construct.
-
-See also Note [seqId magic] in MkId
-}
tcExpr expr@(OpApp fix arg1 op arg2) res_ty
| (L loc (HsVar _ (L lv op_name))) <- op
- , op_name `hasKey` seqIdKey -- Note [Typing rule for seq]
- = do { arg1_ty <- newFlexiTyVarTy liftedTypeKind
- ; let arg2_exp_ty = res_ty
- ; arg1' <- tcArg op arg1 arg1_ty 1
- ; arg2' <- addErrCtxt (funAppCtxt op arg2 2) $
- tc_poly_expr_nc arg2 arg2_exp_ty
- ; arg2_ty <- readExpType arg2_exp_ty
- ; op_id <- tcLookupId op_name
- ; let op' = L loc (mkHsWrap (mkWpTyApps [arg1_ty, arg2_ty])
- (HsVar noExtField (L lv op_id)))
- ; return $ OpApp fix arg1' op' arg2' }
-
- | (L loc (HsVar _ (L lv op_name))) <- op
, op_name `hasKey` dollarIdKey -- Note [Typing rule for ($)]
= do { traceTc "Application rule" (ppr op)
; (arg1', arg1_ty) <- tcInferSigma arg1
@@ -1161,26 +1130,11 @@ tcApp m_herald fun@(L loc (HsRecFld _ fld_lbl)) args res_ty
; (tc_fun, fun_ty) <- tcInferRecSelId (Unambiguous sel_name lbl)
; tcFunApp m_herald fun (L loc tc_fun) fun_ty args res_ty }
-tcApp m_herald fun@(L loc (HsVar _ (L _ fun_id))) args res_ty
+tcApp _m_herald (L loc (HsVar _ (L _ fun_id))) args res_ty
-- Special typing rule for tagToEnum#
| fun_id `hasKey` tagToEnumKey
, n_val_args == 1
= tcTagToEnum loc fun_id args res_ty
-
- -- Special typing rule for 'seq'
- -- In the saturated case, behave as if seq had type
- -- forall a (b::TYPE r). a -> b -> b
- -- for some type r. See Note [Typing rule for seq]
- | fun_id `hasKey` seqIdKey
- , n_val_args == 2
- = do { rep <- newFlexiTyVarTy runtimeRepTy
- ; let [alpha, beta] = mkTemplateTyVars [liftedTypeKind, tYPE rep]
- seq_ty = mkSpecForAllTys [alpha,beta]
- (mkTyVarTy alpha `mkVisFunTy` mkTyVarTy beta `mkVisFunTy` mkTyVarTy beta)
- seq_fun = L loc (HsVar noExtField (L loc seqId))
- -- seq_ty = forall (a:*) (b:TYPE r). a -> b -> b
- -- where 'r' is a meta type variable
- ; tcFunApp m_herald fun seq_fun seq_ty args res_ty }
where
n_val_args = count isHsValArg args
diff --git a/testsuite/tests/simplCore/should_run/SeqRule.hs b/testsuite/tests/simplCore/should_run/SeqRule.hs
index 29a1951209..406add55ca 100644
--- a/testsuite/tests/simplCore/should_run/SeqRule.hs
+++ b/testsuite/tests/simplCore/should_run/SeqRule.hs
@@ -2,7 +2,7 @@
-- This test checks that the magic treatment of RULES
-- for 'seq' works right.
--
--- See Note [RULES for seq] in MkId for more details
+-- See Note [User-defined RULES for seq] in MkId for more details
module Main where
diff --git a/testsuite/tests/typecheck/should_compile/T13050.stderr b/testsuite/tests/typecheck/should_compile/T13050.stderr
index 36e22ae3f8..87b1312b4b 100644
--- a/testsuite/tests/typecheck/should_compile/T13050.stderr
+++ b/testsuite/tests/typecheck/should_compile/T13050.stderr
@@ -12,10 +12,6 @@ T13050.hs:4:9: warning: [-Wtyped-holes (in -Wdefault)]
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
@@ -76,6 +72,10 @@ T13050.hs:4:9: warning: [-Wtyped-holes (in -Wdefault)]
with min @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Classes’))
+ 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’))
return :: forall (m :: * -> *) a. Monad m => a -> m a
with return @((->) Int) @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
@@ -98,10 +98,6 @@ T13050.hs:5:11: warning: [-Wtyped-holes (in -Wdefault)]
g :: Int -> Int -> Int (bound at T13050.hs:5:1)
f :: Int -> Int -> Int (defined at T13050.hs:4: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
@@ -162,6 +158,10 @@ T13050.hs:5:11: warning: [-Wtyped-holes (in -Wdefault)]
with min @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Classes’))
+ 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’))
return :: forall (m :: * -> *) a. Monad m => a -> m a
with return @((->) Int) @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
@@ -185,10 +185,6 @@ T13050.hs:6:11: warning: [-Wtyped-holes (in -Wdefault)]
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)
- 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
@@ -249,6 +245,10 @@ T13050.hs:6:11: warning: [-Wtyped-holes (in -Wdefault)]
with min @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
(and originally defined in ‘GHC.Classes’))
+ 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’))
return :: forall (m :: * -> *) a. Monad m => a -> m a
with return @((->) Int) @Int
(imported from ‘Prelude’ at T13050.hs:1:8-17
diff --git a/testsuite/tests/typecheck/should_compile/T14590.stderr b/testsuite/tests/typecheck/should_compile/T14590.stderr
index 455898be1a..52ecc8335d 100644
--- a/testsuite/tests/typecheck/should_compile/T14590.stderr
+++ b/testsuite/tests/typecheck/should_compile/T14590.stderr
@@ -13,10 +13,6 @@ T14590.hs:4:13: warning: [-Wtyped-holes (in -Wdefault)]
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
@@ -77,6 +73,10 @@ T14590.hs:4:13: warning: [-Wtyped-holes (in -Wdefault)]
with min @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Classes’))
+ 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’))
return :: forall (m :: * -> *) a. Monad m => a -> m a
with return @((->) Int) @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
@@ -101,10 +101,6 @@ T14590.hs:5:13: warning: [-Wtyped-holes (in -Wdefault)]
f1 :: Int -> Int -> Int (defined at T14590.hs:4: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
@@ -165,6 +161,10 @@ T14590.hs:5:13: warning: [-Wtyped-holes (in -Wdefault)]
with min @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Classes’))
+ 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’))
return :: forall (m :: * -> *) a. Monad m => a -> m a
with return @((->) Int) @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
@@ -188,10 +188,6 @@ T14590.hs:6:11: warning: [-Wtyped-holes (in -Wdefault)]
f1 :: Int -> Int -> Int (defined at T14590.hs:4:1)
f2 :: Int -> Int -> Int (defined at T14590.hs:5:1)
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
@@ -252,6 +248,10 @@ T14590.hs:6:11: warning: [-Wtyped-holes (in -Wdefault)]
with min @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Classes’))
+ 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’))
return :: forall (m :: * -> *) a. Monad m => a -> m a
with return @((->) Int) @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
@@ -276,10 +276,6 @@ T14590.hs:7:11: warning: [-Wtyped-holes (in -Wdefault)]
f1 :: Int -> Int -> Int (defined at T14590.hs:4:1)
f2 :: Int -> Int -> Int (defined at T14590.hs:5:1)
f3 :: Int -> Int -> Int (defined at T14590.hs:6:1)
- 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
@@ -340,6 +336,10 @@ T14590.hs:7:11: warning: [-Wtyped-holes (in -Wdefault)]
with min @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
(and originally defined in ‘GHC.Classes’))
+ 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’))
return :: forall (m :: * -> *) a. Monad m => a -> m a
with return @((->) Int) @Int
(imported from ‘Prelude’ at T14590.hs:1:8-13
diff --git a/testsuite/tests/typecheck/should_compile/abstract_refinement_hole_fits.stderr b/testsuite/tests/typecheck/should_compile/abstract_refinement_hole_fits.stderr
index 227df63ecc..e422b8629e 100644
--- a/testsuite/tests/typecheck/should_compile/abstract_refinement_hole_fits.stderr
+++ b/testsuite/tests/typecheck/should_compile/abstract_refinement_hole_fits.stderr
@@ -108,10 +108,10 @@ abstract_refinement_hole_fits.hs:4:5: warning: [-Wtyped-holes (in -Wdefault)]
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
+ seq (_ :: a13) (_ :: [Integer] -> Integer)
+ where seq :: forall a b. a -> b -> b
($) (_ :: a5 -> [Integer] -> Integer) (_ :: a5)
where ($) :: forall a b. (a -> b) -> a -> b
return (_ :: [Integer] -> Integer) (_ :: t1)
@@ -228,10 +228,10 @@ abstract_refinement_hole_fits.hs:7:5: warning: [-Wtyped-holes (in -Wdefault)]
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
+ seq (_ :: a13) (_ :: Integer -> [Integer] -> Integer)
+ where seq :: forall a b. a -> b -> b
($) (_ :: a5 -> Integer -> [Integer] -> Integer) (_ :: a5)
where ($) :: forall a b. (a -> b) -> a -> b
return (_ :: Integer -> [Integer] -> Integer) (_ :: t1)
diff --git a/testsuite/tests/typecheck/should_compile/holes.stderr b/testsuite/tests/typecheck/should_compile/holes.stderr
index 016c31372b..bcf7dc060d 100644
--- a/testsuite/tests/typecheck/should_compile/holes.stderr
+++ b/testsuite/tests/typecheck/should_compile/holes.stderr
@@ -164,7 +164,6 @@ holes.hs:11:15: warning: [-Wtyped-holes (in -Wdefault)]
quot :: forall a. Integral a => a -> a -> a
quotRem :: forall a. Integral a => a -> a -> (a, a)
rem :: forall a. Integral a => a -> a -> a
- 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
@@ -185,6 +184,7 @@ holes.hs:11:15: warning: [-Wtyped-holes (in -Wdefault)]
a -> (b, a)
round :: forall a b. (RealFrac a, Integral b) => a -> b
truncate :: forall a b. (RealFrac a, Integral b) => a -> b
+ seq :: forall a b. a -> b -> b
($) :: forall a b. (a -> b) -> a -> b
either :: forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
curry :: forall a b c. ((a, b) -> c) -> a -> b -> c
diff --git a/testsuite/tests/typecheck/should_compile/holes3.stderr b/testsuite/tests/typecheck/should_compile/holes3.stderr
index bad5877d2e..7a8f513f25 100644
--- a/testsuite/tests/typecheck/should_compile/holes3.stderr
+++ b/testsuite/tests/typecheck/should_compile/holes3.stderr
@@ -167,7 +167,6 @@ holes3.hs:11:15: error:
quot :: forall a. Integral a => a -> a -> a
quotRem :: forall a. Integral a => a -> a -> (a, a)
rem :: forall a. Integral a => a -> a -> a
- 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
@@ -188,6 +187,7 @@ holes3.hs:11:15: error:
a -> (b, a)
round :: forall a b. (RealFrac a, Integral b) => a -> b
truncate :: forall a b. (RealFrac a, Integral b) => a -> b
+ seq :: forall a b. a -> b -> b
($) :: forall a b. (a -> b) -> a -> b
either :: forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
curry :: forall a b c. ((a, b) -> c) -> a -> b -> c
diff --git a/testsuite/tests/warnings/should_compile/PluralS.stderr b/testsuite/tests/warnings/should_compile/PluralS.stderr
index d03efa5ad6..42c81daf5f 100644
--- a/testsuite/tests/warnings/should_compile/PluralS.stderr
+++ b/testsuite/tests/warnings/should_compile/PluralS.stderr
@@ -1,7 +1,7 @@
PluralS.hs:15:17: warning: [-Wtype-defaults (in -Wall)]
• Defaulting the following constraint to type ‘Integer’
- Num t0 arising from the literal ‘123’
+ Num a0 arising from the literal ‘123’
• In the first argument of ‘seq’, namely ‘123’
In the expression: 123 `seq` ()
In an equation for ‘defaultingNum’: defaultingNum = 123 `seq` ()