Commit 372da668 authored by Simon Peyton Jones's avatar Simon Peyton Jones

Improving error messages

parent 78b4c82c
Pipeline #20290 failed with stages
in 121 minutes and 34 seconds
......@@ -39,6 +39,7 @@ import GHC.Hs.Binds
-- others:
import GHC.Tc.Types.Evidence
import GHC.Core
import GHC.Types.Id( Id )
import GHC.Types.Name
import GHC.Types.Name.Set
import GHC.Types.Basic
......@@ -591,7 +592,6 @@ deriving instance (Data (hs_syn GhcTc), Typeable hs_syn) => Data (HsWrap hs_syn)
-- ---------------------------------------------------------------------
type instance XVar (GhcPass _) = NoExtField
type instance XUnboundVar (GhcPass _) = NoExtField
type instance XConLikeOut (GhcPass _) = NoExtField
type instance XRecFld (GhcPass _) = NoExtField
type instance XOverLabel (GhcPass _) = NoExtField
......@@ -602,6 +602,10 @@ type instance XLam (GhcPass _) = NoExtField
type instance XLamCase (GhcPass _) = NoExtField
type instance XApp (GhcPass _) = NoExtField
type instance XUnboundVar GhcPs = NoExtField
type instance XUnboundVar GhcRn = NoExtField
type instance XUnboundVar GhcTc = Id
type instance XAppTypeE GhcPs = NoExtField
type instance XAppTypeE GhcRn = NoExtField
type instance XAppTypeE GhcTc = Type
......@@ -1236,7 +1240,6 @@ isAtomicHsExpr (HsOverLit {}) = True
isAtomicHsExpr (HsIPVar {}) = True
isAtomicHsExpr (HsOverLabel {}) = True
isAtomicHsExpr (HsUnboundVar {}) = True
isAtomicHsExpr (HsPar _ e) = isAtomicHsExpr (unLoc e)
isAtomicHsExpr (HsRecFld{}) = True
isAtomicHsExpr (XExpr x)
| GhcTc <- ghcPass @p
......
......@@ -260,8 +260,8 @@ dsLExprNoLP (L loc e)
dsExpr :: HsExpr GhcTc -> DsM CoreExpr
dsExpr (HsPar _ e) = dsLExpr e
dsExpr (ExprWithTySig _ e _) = dsLExpr e
dsExpr (HsVar _ (L _ var)) = dsHsVar var
dsExpr (HsUnboundVar {}) = panic "dsExpr: HsUnboundVar" -- Typechecker eliminates them
dsExpr (HsVar _ (L _ id)) = dsHsVar id
dsExpr (HsUnboundVar id _) = dsHsVar id
dsExpr (HsConLikeOut _ con) = dsConLike con
dsExpr (HsIPVar {}) = panic "dsExpr: HsIPVar"
dsExpr (HsOverLabel{}) = panic "dsExpr: HsOverLabel"
......
......@@ -2005,7 +2005,7 @@ patSynErr item l e explanation =
explanation
; return (L l hsHoleExpr) }
hsHoleExpr :: HsExpr (GhcPass id)
hsHoleExpr :: HsExpr GhcPs
hsHoleExpr = HsUnboundVar noExtField (mkVarOcc "_")
-- | See Note [Ambiguous syntactic categories] and Note [PatBuilder]
......
......@@ -1449,8 +1449,8 @@ mkTyVarEqErr dflags ctxt report ct tv1 ty2
; mkTyVarEqErr' dflags ctxt report ct tv1 ty2 }
mkTyVarEqErr' dflags ctxt report ct tv1 ty2
| isUserSkolem ctxt tv1 -- ty2 won't be a meta-tyvar; we would have
-- swapped in Solver.Canonical.canEqTyVarHomo
| isSkolemTyVar tv1 -- ty2 won't be a meta-tyvar; we would have
-- swapped in Solver.Canonical.canEqTyVarHomo
|| isTyVarTyVar tv1 && not (isTyVarTy ty2)
|| ctEqRel ct == ReprEq
-- The cases below don't really apply to ReprEq (except occurs check)
......@@ -1592,6 +1592,7 @@ mkEqInfoMsg ct ty1 ty2
<+> text "is a non-injective type family"
| otherwise = empty
{-
isUserSkolem :: ReportErrCtxt -> TcTyVar -> Bool
-- See Note [Reporting occurs-check errors]
isUserSkolem ctxt tv
......@@ -1602,6 +1603,7 @@ isUserSkolem ctxt tv
is_user_skol_info (InferSkol {}) = False
is_user_skol_info _ = True
-}
misMatchOrCND :: Bool -> ReportErrCtxt -> Ct
-> TcType -> TcType -> Report
......
This diff is collapsed.
......@@ -345,7 +345,7 @@ tcExpr expr@(SectionR x op arg2) res_ty
= do { (op', op_ty) <- tcInferRhoNC op
; (wrap_fun, [arg1_ty, arg2_ty], op_res_ty)
<- matchActualFunTysRho (mk_op_msg op) fn_orig
(Just (unLoc op)) 2 op_ty
(Just (ppr op)) 2 op_ty
; arg2' <- tcValArg (unLoc op) arg2 arg2_ty 2
; let expr' = SectionR x (mkLHsWrap wrap_fun op') arg2'
act_res_ty = mkVisFunTy arg1_ty op_res_ty
......@@ -365,7 +365,7 @@ tcExpr expr@(SectionL x arg1 op) res_ty
; (wrap_fn, (arg1_ty:arg_tys), op_res_ty)
<- matchActualFunTysRho (mk_op_msg op) fn_orig
(Just (unLoc op)) n_reqd_args op_ty
(Just (ppr op)) n_reqd_args op_ty
; arg1' <- tcValArg (unLoc op) arg1 arg1_ty 1
; let expr' = SectionL x arg1' (mkLHsWrap wrap_fn op')
act_res_ty = mkVisFunTys arg_tys op_res_ty
......@@ -853,7 +853,7 @@ tcExpr expr@(RecordUpd { rupd_expr = record_expr, rupd_flds = rbnds }) res_ty
scrut_ty = TcType.substTy scrut_subst con1_res_ty
con1_arg_tys' = map (TcType.substTy result_subst) con1_arg_tys
; co_scrut <- unifyType (Just (unLoc record_expr)) record_rho scrut_ty
; co_scrut <- unifyType (Just (ppr record_expr)) record_rho scrut_ty
-- NB: normal unification is OK here (as opposed to subsumption),
-- because for this to work out, both record_rho and scrut_ty have
-- to be normal datatypes -- no contravariant stuff can go on
......@@ -953,17 +953,14 @@ tcUnboundId :: HsExpr GhcRn -> OccName -> ExpRhoType -> TcM (HsExpr GhcTc)
--
-- Some of these started life as a true expression hole "_".
-- Others might simply be variables that accidentally have no binding site
--
-- We turn all of them into HsVar, since HsUnboundVar can't contain an
-- Id; and indeed the evidence for the ExprHole does bind it, so it's
-- not unbound any more!
tcUnboundId rn_expr occ res_ty
= do { ty <- newOpenFlexiTyVarTy -- Allow Int# etc (#12531)
; name <- newSysName occ
; let ev = mkLocalId name ty
; emitNewExprHole occ ev ty
; tcWrapResultO (UnboundOccurrenceOf occ) rn_expr
(HsVar noExtField (noLoc ev)) ty res_ty }
; let expr' = HsUnboundVar ev occ
orig = UnboundOccurrenceOf occ
; tcWrapResultO orig rn_expr expr' ty res_ty }
{- *********************************************************************
......
......@@ -2408,7 +2408,7 @@ kcCheckDeclHeader_sig kisig name flav
KindedTyVar _ _ v v_hs_ki -> do
v_ki <- tcLHsKindSig (TyVarBndrKindCtxt (unLoc v)) v_hs_ki
discardResult $ -- See Note [discardResult in kcCheckDeclHeader_sig]
unifyKind (Just (HsTyVar noExtField NotPromoted v))
unifyKind (Just (ppr v))
(tyBinderType tb)
v_ki
......@@ -2954,7 +2954,7 @@ tcHsQTyVarBndr _ new_tv (KindedTyVar _ _ (L _ tv_nm) lhs_kind)
; mb_tv <- tcLookupLcl_maybe tv_nm
; case mb_tv of
Just (ATyVar _ tv)
-> do { discardResult $ unifyKind (Just hs_tv)
-> do { discardResult $ unifyKind (Just (ppr tv_nm))
kind (tyVarKind tv)
-- This unify rejects:
-- class C (m :: * -> *) where
......@@ -2962,9 +2962,6 @@ tcHsQTyVarBndr _ new_tv (KindedTyVar _ _ (L _ tv_nm) lhs_kind)
; return tv }
_ -> new_tv tv_nm kind }
where
hs_tv = HsTyVar noExtField NotPromoted (noLoc tv_nm)
-- Used for error messages only
--------------------------------------
-- Binding type/class variables in the
......
......@@ -412,7 +412,7 @@ tc_pat pat_ty penv ps_pat thing_inside = case ps_pat of
; let expr_orig = lexprCtOrigin expr
herald = text "A view pattern expression expects"
; (expr_wrap1, [inf_arg_ty], inf_res_ty)
<- matchActualFunTysRho herald expr_orig (Just (unLoc expr)) 1 expr_ty
<- matchActualFunTysRho herald expr_orig (Just (ppr expr)) 1 expr_ty
-- expr_wrap1 :: expr_ty "->" (inf_arg_ty -> inf_res_ty)
-- Check that overall pattern is more polymorphic than arg type
......
......@@ -874,7 +874,7 @@ tcDataFamInstHeader mb_clsinfo fam_tc imp_vars mb_bndrs fixity
lhs_kind
; let lhs_applied_ty = lhs_ty `mkTcAppTys` lhs_extra_args
hs_lhs = nlHsTyConApp fixity (getName fam_tc) hs_pats
; _ <- unifyKind (Just (unLoc hs_lhs)) lhs_applied_kind res_kind
; _ <- unifyKind (Just (ppr hs_lhs)) lhs_applied_kind res_kind
-- Check that the result kind of the TyCon applied to its args
-- is compatible with the explicit signature (or Type, if there
-- is none)
......
......@@ -84,7 +84,7 @@ import Control.Arrow ( second )
-- returning an uninstantiated sigma-type
matchActualFunTy
:: SDoc -- See Note [Herald for matchExpectedFunTys]
-> Maybe (HsExpr GhcRn) -- The thing with type TcSigmaType
-> Maybe SDoc -- The thing with type TcSigmaType
-> (Arity, [TcSigmaType]) -- Total number of value args in the call, and
-- types of values args to which function has
-- been applied already (reversed)
......@@ -186,7 +186,7 @@ Ugh!
-- for example in function application
matchActualFunTysRho :: SDoc -- See Note [Herald for matchExpectedFunTys]
-> CtOrigin
-> Maybe (HsExpr GhcRn) -- the thing with type TcSigmaType
-> Maybe SDoc -- the thing with type TcSigmaType
-> Arity
-> TcSigmaType
-> TcM (HsWrapper, [TcSigmaType], TcRhoType)
......@@ -521,7 +521,7 @@ tcWrapResultO :: CtOrigin -> HsExpr GhcRn -> HsExpr GhcTcId -> TcSigmaType -> Ex
tcWrapResultO orig rn_expr expr actual_ty res_ty
= do { traceTc "tcWrapResult" (vcat [ text "Actual: " <+> ppr actual_ty
, text "Expected:" <+> ppr res_ty ])
; wrap <- tcSubTypeNC orig GenSigCtxt (Just rn_expr) actual_ty res_ty
; wrap <- tcSubTypeNC orig GenSigCtxt (Just (ppr rn_expr)) actual_ty res_ty
; return (mkHsWrap wrap expr) }
tcWrapResultMono :: HsExpr GhcRn -> HsExpr GhcTcId
......@@ -535,7 +535,7 @@ tcWrapResultMono rn_expr expr act_ty res_ty
= ASSERT2( isRhoTy act_ty, ppr act_ty $$ ppr rn_expr )
do { co <- case res_ty of
Infer inf_res -> fillInferResult act_ty inf_res
Check exp_ty -> unifyType (Just rn_expr) act_ty exp_ty
Check exp_ty -> unifyType (Just (ppr rn_expr)) act_ty exp_ty
; return (mkHsWrapCo co expr) }
------------------------
......@@ -567,7 +567,7 @@ tcSubType orig ctxt ty_actual ty_expected
tcSubTypeNC :: CtOrigin -- Used when instantiating
-> UserTypeCtxt -- Used when skolemising
-> Maybe (HsExpr GhcRn) -- The expression that has type 'actual' (if known)
-> Maybe SDoc -- The expression that has type 'actual' (if known)
-> TcSigmaType -- Actual type
-> ExpRhoType -- Expected type
-> TcM HsWrapper
......@@ -1173,8 +1173,9 @@ The exported functions are all defined as versions of some
non-exported generic functions.
-}
unifyType :: Maybe (HsExpr GhcRn) -- ^ If present, has type 'ty1'
-> TcTauType -> TcTauType -> TcM TcCoercionN
unifyType :: Maybe SDoc -- ^ If present, the thing that has type ty1
-> TcTauType -> TcTauType -- ty1, ty2
-> TcM TcCoercionN -- :: ty1 ~# ty2
-- Actual and expected types
-- Returns a coercion : ty1 ~ ty2
unifyType thing ty1 ty2
......@@ -1197,13 +1198,13 @@ unifyTypeET ty1 ty2
, uo_visible = True }
unifyKind :: Maybe (HsType GhcRn) -> TcKind -> TcKind -> TcM CoercionN
unifyKind thing ty1 ty2
unifyKind :: Maybe SDoc -> TcKind -> TcKind -> TcM CoercionN
unifyKind mb_thing ty1 ty2
= uType KindLevel origin ty1 ty2
where
origin = TypeEqOrigin { uo_actual = ty1
, uo_expected = ty2
, uo_thing = ppr <$> thing
, uo_thing = mb_thing
, uo_visible = True }
......
......@@ -4,12 +4,10 @@ import GHC.Prelude
import GHC.Tc.Utils.TcType ( TcTauType )
import GHC.Tc.Types ( TcM )
import GHC.Tc.Types.Evidence ( TcCoercion )
import GHC.Hs.Expr ( HsExpr )
import GHC.Hs.Types ( HsType )
import GHC.Hs.Extension ( GhcRn )
import GHC.Utils.Outputable( SDoc )
-- This boot file exists only to tie the knot between
-- GHC.Tc.Utils.Unify and Inst
unifyType :: Maybe (HsExpr GhcRn) -> TcTauType -> TcTauType -> TcM TcCoercion
unifyKind :: Maybe (HsType GhcRn) -> TcTauType -> TcTauType -> TcM TcCoercion
unifyType :: Maybe SDoc -> TcTauType -> TcTauType -> TcM TcCoercion
unifyKind :: Maybe SDoc -> TcTauType -> TcTauType -> TcM TcCoercion
......@@ -915,8 +915,8 @@ zonkExpr env (XExpr (HsWrap co_fn expr))
new_expr <- zonkExpr env1 expr
return (XExpr (HsWrap new_co_fn new_expr))
zonkExpr _ e@(HsUnboundVar {})
= return e
zonkExpr env (HsUnboundVar v occ)
= return (HsUnboundVar (zonkIdOcc env v) occ)
zonkExpr _ expr = pprPanic "zonkExpr" (ppr expr)
......
......@@ -9,6 +9,8 @@ module Bug where
-- (which here is switched on by ($))
-- beecause of a very subtle issue where we instantiate an
-- instantiation variable with (F alpha), where F is a type function
--
-- It's a stripped-dwn version of T5490
register :: forall rs op_ty.
(HDrop rs ~ HSingle (WaitOpResult op_ty))
......
......@@ -13,10 +13,11 @@ T4485.hs:50:15: error:
(The choice depends on the instantiation of ‘m0’
To pick the first instance above, use IncoherentInstances
when compiling the other instance declarations)
• In the first argument of ‘($)’, namely ‘asChild’
In the expression: asChild $ (genElement "foo")
• In the expression: asChild $ (genElement "foo")
In an equation for ‘asChild’:
asChild b = asChild $ (genElement "foo")
In the instance declaration for
‘EmbedAsChild (IdentityT IO) FooBar’
T4485.hs:50:26: error:
• Ambiguous type variable ‘m0’ arising from a use of ‘genElement’
......
module HolesInfix where
f, g, q :: Int -> Int -> Int
--f, g, q :: Int -> Int -> Int
f x y = _ x y
g x y = x `_` y
q x y = x `_a` y
--g x y = x `_` y
--q x y = x `_a` y
......@@ -8,7 +8,6 @@
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeApplications #-}
module Bug (await, bug) where
......@@ -23,6 +22,8 @@ fromAttempt ∷ Attempt α → IO α
fromAttempt (Success a) = return a
fromAttempt (Failure e) = throwIO e
data Inject f α = β . Inject (f β) (α β)
class Completable f where
complete f α α IO Bool
......@@ -83,34 +84,29 @@ instance (Typeable n, Exception e) ⇒ Exception (NthException n e)
instance WaitOp (WaitOps rs) where
type WaitOpResult (WaitOps rs) = HElemOf rs
inj :: Peano n -> Attempt (HNth n l) -> Attempt (HElemOf l)
inj = error "urk"
rwo :: forall rs f. f (Attempt (WaitOpResult (WaitOps rs))) IO Bool
rwo ev = do
let register n . Peano n WaitOps (HDrop n rs) IO Bool
register n (WaitOp (op :: op_ty)) =
((($) -- (px -> qx) -> px -> qx px=a_a2iT qx=b_a2iU
(Inject @f ev) -- Instantiate at ax=a2iW bx=a2iX;
-- (ax -> bx) -> Inject f ax
-- ql with arg or Inject: f bx ~ f (Attempt (WaitOpReslt (WaitOps rs)))
-- bx := Attempt (WaitOpResult (WaitOps rs) = Attempt (HElemOf rs)
-- px := (ax -> bx)
-- qx := Inject f ax
(inj @n n) -- instantiate lx=l_a2iZ;
-- Attempt (HNth n lx) -> Attempt (HElemOf lx)
-- res_ty px = (ax->bx) ~ Attempt (HNth n lx) -> Attempt (HElemOf lx)
-- ax := Attempt (HNth n lx)
-- bx := Attempt (HElemOf lx)
) :: Inject f (Attempt (WaitOpResult op_ty)))
-- Result ql: Attempt (WaitOpResult op_ty) ~ ax = Attempt (HNth n lx)
`seq` return True
return True
data Inject f a where
Inject :: f a b . (f b) -> (a b) -> Inject f a
registerWaitOp ops ev = do
let inj n (Success r) = Success (HNth n r)
inj n (Failure e) = Failure (NthException n e)
register n . HDropClass n rs
Bool Peano n WaitOps (HDrop n rs) IO Bool
register first n (WaitOp op) = do
t try $ registerWaitOp op (Inject ev $ inj n)
r case t of
Right r return r
Left e complete ev $ inj n $ Failure (e SomeException)
return $ r || not first
register first n (op :? ops') = do
t try $ registerWaitOp op (Inject ev $ inj n)
case t of
Right True case waitOpsNonEmpty ops' of
HNonEmptyInst case hTailDropComm HTailDropComm n rs of
HTailDropComm register False (PSucc n) ops'
Right False return $ not first
Left e do
c complete ev $ inj n $ Failure (e SomeException)
return $ c || not first
case waitOpsNonEmpty ops of
HNonEmptyInst register True PZero ops
bug IO Int
bug = do
......
T15862.hs:17:7: error:
• No instance for (Typeable 'MkFoo) arising from a use of ‘typeRep’
GHC can't yet do polykinded
Typeable ('MkFoo :: (forall a. a) -> Foo)
• In the expression: typeRep @MkFoo
In an equation for ‘foo’: foo = typeRep @MkFoo
T15862.hs:25:7: error:
• No instance for (Typeable 'MkBar) arising from a use of ‘typeRep’
GHC can't yet do polykinded Typeable ('MkBar :: Bool -> Bar)
• In the expression: typeRep
In an equation for ‘bar’: bar = typeRep
T15862.hs:30:8: error:
• No instance for (Typeable 'MkQuux)
arising from a use of ‘typeRep’
GHC can't yet do polykinded
Typeable ('MkQuux :: (# Bool | Int #) -> Quux)
• In the expression: typeRep
In an equation for ‘quux’: quux = typeRep
T15862.hs:36:8: error:
• No instance for (Typeable 'MkQuuz)
arising from a use of ‘typeRep’
GHC can't yet do polykinded Typeable ('MkQuuz :: Quuz)
• In the expression: typeRep
In an equation for ‘quuz’: quuz = typeRep
T15862.hs:16:16: error:
• Expected kind ‘k0’, but ‘MkFoo’ has kind ‘(forall a. a) -> Foo’
Cannot instantiate unification variable ‘k0’
with a kind involving polytypes: (forall a. a) -> Foo
• In the first argument of ‘TypeRep’, namely ‘MkFoo’
In the type signature: foo :: TypeRep MkFoo
......@@ -3,4 +3,6 @@ module T2846 where
f :: String
f = show ([1,2,3] :: [Num a => a])
-- Rejected with Quick Look
-- The arg of 'show' is a naked 'a'
-- And the actual arg has type (forall a. [Num a => a]), which is polymorphic
T2846b.hs:5:5: error:
• No instance for (Show (Num a0 => a0))
arising from a use of ‘show’
(maybe you haven't applied a function to enough arguments?)
• In the expression: show ([1, 2, 3] :: [Num a => a])
T2846b.hs:5:11: error:
• Couldn't match expected type ‘a1’
with actual type ‘[Num a0 => a0]’
Cannot instantiate unification variable ‘a1’
with a type involving polytypes: [Num a0 => a0]
• In the first argument of ‘show’, namely
‘([1, 2, 3] :: [Num a => a])’
In the expression: show ([1, 2, 3] :: [Num a => a])
In an equation for ‘f’: f = show ([1, 2, 3] :: [Num a => a])
......@@ -2,6 +2,7 @@
T3176.hs:9:27: error:
• Cannot use record selector ‘unES’ as a function due to escaped type variables
Probable fix: use pattern-matching syntax instead
• In the first argument of ‘($)’, namely ‘unES’
In the second argument of ‘($)’, namely ‘unES $ f t’
• In the second argument of ‘($)’, namely ‘unES $ f t’
In the expression: show $ unES $ f t
In an equation for ‘smallPrintES’:
smallPrintES f t = show $ unES $ f t
......@@ -5,8 +5,8 @@ T6069.hs:13:15: error:
Expected: ST s0 Int -> b0
Actual: (forall s. ST s b0) -> b0
• In the second argument of ‘(.)’, namely ‘runST’
In the expression: print . runST
In the expression: (print . runST) fourty_two
In an equation for ‘f1’: f1 = (print . runST) fourty_two
T6069.hs:14:15: error:
• Couldn't match type: forall s. ST s b1
......
T8450.hs:8:20: error:
T8450.hs:8:19: error:
• Couldn't match type ‘a’ with ‘Bool’
Expected: Either Bool ()
Actual: Either a ()
......
......@@ -575,3 +575,4 @@ test('ExplicitSpecificity7', normal, compile_fail, [''])
test('ExplicitSpecificity8', normal, compile_fail, [''])
test('ExplicitSpecificity9', normal, compile_fail, [''])
test('ExplicitSpecificity10', normal, compile_fail, [''])
test('too-many', normal, compile_fail, [''])
......@@ -9,7 +9,7 @@ tcfail140.hs:10:7: error:
tcfail140.hs:12:10: error:
• Couldn't match expected type ‘t1 -> t’ with actual type ‘Int’
• The operator ‘f’ takes two value arguments,
• The function ‘f’ is applied to two value arguments,
but its type ‘Int -> Int’ has only one
In the expression: 3 `f` 4
In an equation for ‘rot’: rot xs = 3 `f` 4
......@@ -19,7 +19,7 @@ tcfail140.hs:12:10: error:
tcfail140.hs:14:15: error:
• Couldn't match expected type ‘a -> b’ with actual type ‘Int’
• The operator ‘f’ takes two value arguments,
but its type ‘Int -> Int’ has only one
but its type ‘Int -> Int’ has only one
In the first argument of ‘map’, namely ‘(3 `f`)’
In the expression: map (3 `f`) xs
• Relevant bindings include
......
......@@ -2,7 +2,7 @@
tcfail204.hs:10:7: error: [-Wtype-defaults (in -Wall), -Werror=type-defaults]
• Defaulting the following constraints to type ‘Double’
(RealFrac a0)
arising from a use of ‘ceiling’ at tcfail204.hs:10:7-17
arising from a use of ‘ceiling’ at tcfail204.hs:10:7-13
(Fractional a0)
arising from the literal ‘6.3’ at tcfail204.hs:10:15-17
• In the expression: ceiling 6.3
......
module TooMany where
foo :: (Int -> Int -> Bool) -> Int
foo = error "urk"
f1 :: Int -> Int -> Int -> Bool
f1 = f1
g1 = foo (f1 2 3)
-- Here is is sensible to report
-- f1 is applied to too many arguments
f2 :: Int -> Bool
f2 = f2
g2 = foo (f2 2)
-- Here is is /not/ sensible to report
-- f2 is applied to too many arguments
too-many.hs:9:11: error:
• Couldn't match type ‘Bool’ with ‘Int -> Bool’
Expected: Int -> Int -> Bool
Actual: Int -> Bool
• Possible cause: ‘f1’ is applied to too many arguments
In the first argument of ‘foo’, namely ‘(f1 2 3)’
In the expression: foo (f1 2 3)
In an equation for ‘g1’: g1 = foo (f1 2 3)
too-many.hs:16:11: error:
• Couldn't match expected type ‘Int -> Int -> Bool’
with actual type ‘Bool’
• In the first argument of ‘foo’, namely ‘(f2 2)’
In the expression: foo (f2 2)
In an equation for ‘g2’: g2 = foo (f2 2)
......@@ -8,7 +8,7 @@ PluralS.hs:15:17: warning: [-Wtype-defaults (in -Wall)]
PluralS.hs:17:24: warning: [-Wtype-defaults (in -Wall)]
• Defaulting the following constraints to type ‘Integer’
(Show a0) arising from a use of ‘show’ at PluralS.hs:17:24-31
(Show a0) arising from a use of ‘show’ at PluralS.hs:17:24-27
(Num a0) arising from the literal ‘123’ at PluralS.hs:17:29-31
• In the expression: show 123
In an equation for ‘defaultingNumAndShow’:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment