Commit 23eb4fb2 authored by cgibbard's avatar cgibbard Committed by cgibbard

Broaden the circumstances under which inaccessible code warnings are reported...

Broaden the circumstances under which inaccessible code warnings are reported due to unsatisfiable constraints. Fix insoluble constraints arising from the ambiguity checker (#17295)

Edited to fix an issue where these warnings would sometimes be reported in code generated by deriving declarations/clauses.

There is still lots to relitigate invovling local instances, absurdity,
and implication constraints, as witnessed by the thread, but I think a
safe first step that fixes the original issues is removing ering on
insoluble constraints even when `-XAllowAmbiguousTypes` is on.

As far as I can tell, this extra error checking was not done for any
deap theoretical reasons, but because concerns that users would be
mislead from incorrect advice in an error message. The check was added
in 43856a00, which references #8392,
where it was written in comment
ghc/ghc#8392 (comment 75571) that the naive
fix then made

```haskell
f :: Bool ~ Int => ()
f = ()
```

Report

```
Couldn't match type ‛Bool’ with ‛Int’
Inaccessible code in the type signature for f :: Bool ~ Int =>
()
To defer this ambiguity check to use sites, enable
AllowAmbiguousTypes
In the ambiguity check for: Bool ~ Int => ()
In the type signature for ‛f’: f :: Bool ~ Int => ()
```

It no longer does with this same change years later, so problem avoided.
parent a1a75aa9
......@@ -763,12 +763,15 @@ expression, to print a different context line or skip one
altogether.
Whenever we 'setSrcSpan' a 'generatedSrcSpan', we update a field in
TcLclEnv called 'tcl_in_gen_code', setting it to True, which indicates that we
entered generated code, i.e code fabricated by the compiler when rebinding some
syntax. If someone tries to push some error context line while that field is set
to True, the pushing won't actually happen and the context line is just dropped.
TcLclEnv called 'tcl_provenance', setting it to RebindableSyntaxCP, which
indicates that we entered generated code, i.e code fabricated by the compiler
when rebinding some syntax. The function tcl_rebindable_syntax will produce True
when this is the case. If someone tries to push some error context line
while that field is set to RebindableSyntaxCP, the pushing won't actually
happen and the context line is just dropped.
Once we 'setSrcSpan' a real span (for an expression that was in the original
source code), we set 'tcl_in_gen_code' back to False, indicating that we
source code), we set 'tcl_provenance' back to whatever it was prior, indicating that we
"emerged from the generated code tunnel", and that the expressions we will be
processing are relevant to report in context lines again.
......
......@@ -330,7 +330,7 @@ runRnSplice flavour run_meta ppr_res splice
-- Run the expression
; mod_finalizers_ref <- newTcRef []
; result <- setStage (RunSplice mod_finalizers_ref) $
; result <- setStage (RunSplice mod_finalizers_ref) $ withProvenance TemplateHaskellCP $
run_meta zonked_q_expr
; mod_finalizers <- readTcRef mod_finalizers_ref
; traceSplice (SpliceInfo { spliceDescription = what
......
......@@ -66,7 +66,7 @@ import GHC.Data.Maybe
import qualified GHC.LanguageExtensions as LangExt
import GHC.Utils.FV ( fvVarList, unionFV )
import Control.Monad ( when )
import Control.Monad ( when, unless )
import Data.Foldable ( toList )
import Data.List ( partition, mapAccumL, sortBy, unfoldr )
......@@ -596,8 +596,13 @@ reportWanteds ctxt tc_lvl (WC { wc_simple = simples, wc_impl = implics
-- we might suppress its error message, and proceed on past
-- type checking to get a Lint error later
report1 = [ ("custom_error", unblocked is_user_type_error, True, mkUserTypeErrorReporter)
, given_eq_spec
, -- See Note [Given warnings]
-- Don't bother doing this if -Winaccessible-code isn't enabled.
-- See Note [Avoid -Winaccessible-code when deriving] in GHC.Tc.TyCl.Instance.
-- False means don't suppress subsequent errors, because these are warnings anyway.
if any ic_warn_inaccessible (cec_encl ctxt)
then ("insoluble1a", is_given_eq, False, mkGivenWarningReporter)
else ("insoluble1b", is_given_eq, False, ignoreGivenWarningReporter)
, ("insoluble2", unblocked utterly_wrong, True, mkGroupReporter mkEqErr)
, ("skolem eq1", unblocked very_wrong, True, mkSkolReporter)
, ("skolem eq2", unblocked skolem_eq, True, mkSkolReporter)
......@@ -664,29 +669,6 @@ reportWanteds ctxt tc_lvl (WC { wc_simple = simples, wc_impl = implics
is_irred _ (IrredPred {}) = True
is_irred _ _ = False
given_eq_spec -- See Note [Given errors]
| has_gadt_match (cec_encl ctxt)
= ("insoluble1a", is_given_eq, True, mkGivenErrorReporter)
| otherwise
= ("insoluble1b", is_given_eq, False, ignoreErrorReporter)
-- False means don't suppress subsequent errors
-- Reason: we don't report all given errors
-- (see mkGivenErrorReporter), and we should only suppress
-- subsequent errors if we actually report this one!
-- #13446 is an example
-- See Note [Given errors]
has_gadt_match [] = False
has_gadt_match (implic : implics)
| PatSkol {} <- ic_info implic
, not (ic_no_eqs implic)
, ic_warn_inaccessible implic
-- Don't bother doing this if -Winaccessible-code isn't enabled.
-- See Note [Avoid -Winaccessible-code when deriving] in GHC.Tc.TyCl.Instance.
= True
| otherwise
= has_gadt_match implics
---------------
isSkolemTy :: TcLevel -> Type -> Bool
-- The type is a skolem tyvar
......@@ -754,13 +736,13 @@ mkUserTypeError ctxt ct = mkErrorMsgFromCt ctxt ct
Nothing -> pprPanic "mkUserTypeError" (ppr ct)
mkGivenErrorReporter :: Reporter
-- See Note [Given errors]
mkGivenErrorReporter ctxt cts
mkGivenWarningReporter :: Reporter
-- See Note [Given warnings]
mkGivenWarningReporter ctxt cts
= do { (ctxt, binds_msg, ct) <- relevantBindings True ctxt ct
; dflags <- getDynFlags
; let (implic:_) = cec_encl ctxt
-- Always non-empty when mkGivenErrorReporter is called
-- Always non-empty when mkGivenWarningReporter is called
ct' = setCtLoc ct (setCtLocEnv (ctLoc ct) (ic_env implic))
-- For given constraints we overwrite the env (and hence src-loc)
-- with one from the immediately-enclosing implication.
......@@ -773,21 +755,23 @@ mkGivenErrorReporter ctxt cts
; err <- mkEqErr_help dflags ctxt report ct' ty1 ty2
; traceTc "mkGivenErrorReporter" (ppr ct)
; reportWarning (Reason Opt_WarnInaccessibleCode) err }
; traceTc "mkGivenWarningReporter" (ppr ct)
; unless (tcl_deriving (ctLocEnv (ctLoc ct))) $
reportWarning (Reason Opt_WarnInaccessibleCode) err
}
where
(ct : _ ) = cts -- Never empty
(ty1, ty2) = getEqPredTys (ctPred ct)
ignoreErrorReporter :: Reporter
ignoreGivenWarningReporter :: Reporter
-- Discard Given errors that don't come from
-- a pattern match; maybe we should warn instead?
ignoreErrorReporter ctxt cts
= do { traceTc "mkGivenErrorReporter no" (ppr cts $$ ppr (cec_encl ctxt))
ignoreGivenWarningReporter ctxt cts
= do { traceTc "mkGivenWarningReporter no" (ppr cts $$ ppr (cec_encl ctxt))
; return () }
{- Note [Given errors]
{- Note [Given warnings]
~~~~~~~~~~~~~~~~~~~~~~
Given constraints represent things for which we have (or will have)
evidence, so they aren't errors. But if a Given constraint is
......@@ -807,18 +791,25 @@ warn about that. A classic case is
We'd like to point out that the T3 match is inaccessible. It
will have a Given constraint [G] Int ~ Bool.
But we don't want to report ALL insoluble Given constraints. See Trac
#12466 for a long discussion. For example, if we aren't careful
we'll complain about
f :: ((Int ~ Bool) => a -> a) -> Int
which arguably is OK. It's more debatable for
g :: (Int ~ Bool) => Int -> Int
but it's tricky to distinguish these cases so we don't report
either.
The bottom line is this: has_gadt_match looks for an enclosing
pattern match which binds some equality constraints. If we
find one, we report the insoluble Given.
It's possible that we now over-report some Given constraints.
For example, consider the following two functions:
f :: (Int ~ Bool) => Int -> Int
g :: ((Int ~ Bool) => a -> a) -> Int
While f cannot be used at all, and essentially must be dead code,
the function g could be used, as it only requires a function which
demands an absurd premise. That is, f requires something that is
impossible, while g merely requires something that is unnecessary.
However, it's tricky to distinguish these two cases due to the way
that the constraint solver is written. Since this is now just a
warning though, little harm should be caused by reporting it in
all cases.
See Trac #12466 for a long discussion in the context when this was
still an error. In Trac #11066 it became a warning only. In
discussing issue #17543, it was found that we would like the warning
in a broader range of cases again.
-}
mkGroupReporter :: (ReportErrCtxt -> [Ct] -> TcM ErrMsg)
......@@ -1374,7 +1365,7 @@ mkEqErr _ [] = panic "mkEqErr"
mkEqErr1 :: ReportErrCtxt -> Ct -> TcM ErrMsg
mkEqErr1 ctxt ct -- Wanted or derived;
-- givens handled in mkGivenErrorReporter
-- givens handled in mkGivenWarningReporter
= do { (ctxt, binds_msg, ct) <- relevantBindings True ctxt ct
; rdr_env <- getGlobalRdrEnv
; fam_envs <- tcGetFamInstEnvs
......
......@@ -128,7 +128,7 @@ tcPolyExprNC (L loc expr) res_ty
where -- See Note [Rebindable syntax and HsExpansion), which describes
-- the logic behind this location/context tweaking.
set_loc_and_ctxt l e m = do
inGenCode <- inGeneratedCode
inGenCode <- inRebindableSyntax
if inGenCode && not (isGeneratedSrcSpan l)
then setSrcSpan l $
addExprCtxt e m
......
......@@ -731,20 +731,18 @@ is not set.
------------------
simplifyAmbiguityCheck :: Type -> WantedConstraints -> TcM ()
simplifyAmbiguityCheck ty wanteds
= do { traceTc "simplifyAmbiguityCheck {" (text "type = " <+> ppr ty $$ text "wanted = " <+> ppr wanteds)
simplifyAmbiguityCheck ty wanteds = do
allow_ambiguous <- xoptM LangExt.AllowAmbiguousTypes
if allow_ambiguous
then traceTc "simplifyAmbiguityCheck skipped" empty
else
do { traceTc "simplifyAmbiguityCheck {" (text "type = " <+> ppr ty $$ text "wanted = " <+> ppr wanteds)
; (final_wc, _) <- runTcS $ solveWantedsAndDrop wanteds
-- NB: no defaulting! See Note [No defaulting in the ambiguity check]
; traceTc "End simplifyAmbiguityCheck }" empty
-- Normally report all errors; but with -XAllowAmbiguousTypes
-- report only insoluble ones, since they represent genuinely
-- inaccessible code
; allow_ambiguous <- xoptM LangExt.AllowAmbiguousTypes
; traceTc "reportUnsolved(ambig) {" empty
; unless (allow_ambiguous && not (insolubleWC final_wc))
(discardResult (reportUnsolved final_wc))
; discardResult $ reportUnsolved final_wc
; traceTc "reportUnsolved(ambig) }" empty
; return () }
......
......@@ -1789,7 +1789,7 @@ tcMethodBody clas tyvars dfun_ev_vars inst_tys
-- we want to print out the full source code if there's an error
-- because otherwise the user won't see the code at all
add_meth_ctxt thing
| is_derived = addLandmarkErrCtxt (derivBindCtxt sel_id clas inst_tys) thing
| is_derived = addLandmarkErrCtxt (derivBindCtxt sel_id clas inst_tys) (setDeriving thing)
| otherwise = thing
tcMethodBodyHelp :: HsSigFun -> Id -> TcId
......@@ -2007,7 +2007,7 @@ mkDefMethBind dfun_id clas sel_id dm_name
-- See Note [Default methods in instances]
----------------------
derivBindCtxt :: Id -> Class -> [Type ] -> SDoc
derivBindCtxt :: Id -> Class -> [Type] -> SDoc
derivBindCtxt sel_id clas tys
= vcat [ text "When typechecking the code for" <+> quotes (ppr sel_id)
, nest 2 (text "in a derived instance for"
......
......@@ -27,7 +27,8 @@ module GHC.Tc.Types(
-- The environment types
Env(..),
TcGblEnv(..), TcLclEnv(..),
TcGblEnv(..), TcLclEnv(..), tcl_rebindable_syntax, tcl_deriving, tclSetProvenance,
CodeProvenance(..),
setLclEnvTcLevel, getLclEnvTcLevel,
setLclEnvLoc, getLclEnvLoc,
IfGblEnv(..), IfLclEnv(..),
......@@ -709,12 +710,21 @@ Why? Because they are now Ids not TcIds. This final GlobalEnv is
b) used in the ModDetails of this module
-}
-- | This data type indicates possible types of generated code. Code may have any set of these indicators, and code that the user wrote directly
-- is expected to have none.
data CodeProvenance
= UserSourceCP -- ^ The code was written by the user.
| DerivingCP -- ^ The code was generated by GHC for a deriving clause.
| TemplateHaskellCP -- ^ The code was generated by a Template Haskell splice.
| RebindableSyntaxCP -- ^ The code is the expansion of rebindable syntax.
deriving (Eq, Ord)
data TcLclEnv -- Changes as we move inside an expression
-- Discarded after typecheck/rename; not passed on to desugarer
= TcLclEnv {
tcl_loc :: RealSrcSpan, -- Source span
tcl_ctxt :: [ErrCtxt], -- Error context, innermost on top
tcl_in_gen_code :: Bool, -- See Note [Rebindable syntax and HsExpansion]
tcl_provenance :: CodeProvenance, -- Where did this code come from?
tcl_tclvl :: TcLevel,
tcl_th_ctxt :: ThStage, -- Template Haskell context
......@@ -751,6 +761,28 @@ data TcLclEnv -- Changes as we move inside an expression
tcl_errs :: TcRef Messages -- Place to accumulate errors
}
tclSetProvenance :: CodeProvenance -> TcLclEnv -> TcLclEnv
tclSetProvenance p e = e { tcl_provenance = update (tcl_provenance e) p }
where
-- When setting the provenance of code, we want certain provenances to have priority over others,
-- so `update x y` describes what provenance we report if we enter a region generated by y when we're
-- already in a region generated by x.
update :: CodeProvenance -> CodeProvenance -> CodeProvenance
update x y = case x of
DerivingCP -> DerivingCP
TemplateHaskellCP -> case y of
DerivingCP -> DerivingCP
_ -> TemplateHaskellCP
_ -> y
tcl_rebindable_syntax :: TcLclEnv -> Bool
tcl_rebindable_syntax (TcLclEnv { tcl_provenance = RebindableSyntaxCP }) = True
tcl_rebindable_syntax _ = False
tcl_deriving :: TcLclEnv -> Bool
tcl_deriving (TcLclEnv { tcl_provenance = DerivingCP }) = True
tcl_deriving _ = False
setLclEnvTcLevel :: TcLclEnv -> TcLevel -> TcLclEnv
setLclEnvTcLevel env lvl = env { tcl_tclvl = lvl }
......
......@@ -1070,7 +1070,7 @@ Residual implication looks like
We do /not/ want to set the implication status to IC_Insoluble,
because that'll suppress reports of [W] C b (f b). But we
may not report the insoluble [G] f b ~# b either (see Note [Given errors]
may not report the insoluble [G] f b ~# b either (see Note [Given warnings]
in GHC.Tc.Errors), so we may fail to report anything at all! Yikes.
The same applies to Derived constraints that /arise from/ Givens.
......
......@@ -61,7 +61,8 @@ module GHC.Tc.Utils.Monad(
addDependentFiles,
-- * Error management
getSrcSpanM, setSrcSpan, addLocM, inGeneratedCode,
getSrcSpanM, setSrcSpan, addLocM, inRebindableSyntax,
withProvenance,
wrapLocM, wrapLocFstM, wrapLocSndM,wrapLocM_,
getErrsVar, setErrsVar,
addErr,
......@@ -85,6 +86,7 @@ module GHC.Tc.Utils.Monad(
-- * Context management for the type checker
getErrCtxt, setErrCtxt, addErrCtxt, addErrCtxtM, addLandmarkErrCtxt,
addLandmarkErrCtxtM, popErrCtxt, getCtLocM, setCtLocM,
setDeriving, inDeriving,
-- * Error message generation (type checker)
addErrTc,
......@@ -362,7 +364,7 @@ initTcWithGbl hsc_env gbl_env loc do_this
tcl_errs = errs_var,
tcl_loc = loc,
-- tcl_loc should be over-ridden very soon!
tcl_in_gen_code = False,
tcl_provenance = UserSourceCP,
tcl_ctxt = [],
tcl_rdr = emptyLocalRdrEnv,
tcl_th_ctxt = topStage,
......@@ -896,17 +898,19 @@ getSrcSpanM :: TcRn SrcSpan
getSrcSpanM = do { env <- getLclEnv; return (RealSrcSpan (tcl_loc env) Nothing) }
-- See Note [Rebindable syntax and HsExpansion].
inGeneratedCode :: TcRn Bool
inGeneratedCode = tcl_in_gen_code <$> getLclEnv
inRebindableSyntax :: TcRn Bool
inRebindableSyntax = tcl_rebindable_syntax <$> getLclEnv
withProvenance :: CodeProvenance -> TcRn a -> TcRn a
withProvenance p = updLclEnv (\env -> tclSetProvenance p env)
setSrcSpan :: SrcSpan -> TcRn a -> TcRn a
setSrcSpan (RealSrcSpan loc _) thing_inside =
updLclEnv (\env -> env { tcl_loc = loc, tcl_in_gen_code = False })
thing_inside
updLclEnv (\env -> env { tcl_loc = loc }) $ withProvenance UserSourceCP thing_inside
setSrcSpan loc@(UnhelpfulSpan _) thing_inside
-- See Note [Rebindable syntax and HsExpansion].
| isGeneratedSrcSpan loc =
updLclEnv (\env -> env { tcl_in_gen_code = True }) thing_inside
withProvenance RebindableSyntaxCP thing_inside
| otherwise = thing_inside
addLocM :: (a -> TcM b) -> Located a -> TcM b
......@@ -1139,9 +1143,8 @@ updCtxt :: (Bool -> [ErrCtxt] -> [ErrCtxt]) -> TcM a -> TcM a
{-# INLINE updCtxt #-} -- Note [Inlining addErrCtxt]
-- Helper function for the above
-- The Bool is true if we are in generated code
updCtxt upd = updLclEnv (\ env@(TcLclEnv { tcl_ctxt = ctxt
, tcl_in_gen_code = in_gen }) ->
env { tcl_ctxt = upd in_gen ctxt })
updCtxt upd = updLclEnv (\ env@(TcLclEnv { tcl_ctxt = ctxt }) ->
env { tcl_ctxt = upd (tcl_rebindable_syntax env) ctxt })
popErrCtxt :: TcM a -> TcM a
popErrCtxt = updCtxt (\ _ msgs -> case msgs of { [] -> []; (_ : ms) -> ms })
......@@ -1162,6 +1165,11 @@ setCtLocM (CtLoc { ctl_env = lcl }) thing_inside
, tcl_ctxt = tcl_ctxt lcl })
thing_inside
setDeriving :: TcM a -> TcM a
setDeriving = updLclEnv (\e -> tclSetProvenance DerivingCP e)
inDeriving :: TcM Bool
inDeriving = fmap tcl_deriving getLclEnv
{- *********************************************************************
* *
......
......@@ -54,6 +54,21 @@ Defer01.hs:39:17: warning: [-Wdeferred-type-errors (in -Wdefault)]
a :: a (bound at Defer01.hs:39:3)
i :: a -> () (bound at Defer01.hs:39:1)
Defer01.hs:46:1: warning: [-Winaccessible-code (in -Wdefault)]
Couldn't match type ‘Int’ with ‘Bool’
Inaccessible code in
the type signature for:
k :: (Int ~ Bool) => Int -> Bool
Defer01.hs:46:6: warning: [-Winaccessible-code (in -Wdefault)]
• Couldn't match type ‘Int’ with ‘Bool’
Inaccessible code in
the type signature for:
k :: (Int ~ Bool) => Int -> Bool
• In the ambiguity check for ‘k’
To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
In the type signature: k :: (Int ~ Bool) => Int -> Bool
Defer01.hs:47:7: warning: [-Wdeferred-type-errors (in -Wdefault)]
• Couldn't match expected type ‘Bool’ with actual type ‘Int’
• In the expression: x
......
T15450.hs:5:1: warning: [-Winaccessible-code (in -Wdefault)]
Couldn't match type ‘Int’ with ‘Bool’
Inaccessible code in
the type signature for:
f :: forall a. (Int ~ Bool) => Bool -> a
T15450.hs:5:6: warning: [-Winaccessible-code (in -Wdefault)]
• Couldn't match type ‘Int’ with ‘Bool’
Inaccessible code in
the type signature for:
f :: forall a. (Int ~ Bool) => Bool -> a
• In the ambiguity check for ‘f’
To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
In the type signature: f :: (Int ~ Bool) => Bool -> a
T15450.hs:6:7: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
......@@ -6,6 +21,21 @@ T15450.hs:6:7: warning: [-Wincomplete-patterns (in -Wextra)]
False
True
T15450.hs:8:1: warning: [-Winaccessible-code (in -Wdefault)]
Couldn't match type ‘Int’ with ‘Bool’
Inaccessible code in
the type signature for:
g :: forall a. (Int ~ Bool) => Bool -> a
T15450.hs:8:6: warning: [-Winaccessible-code (in -Wdefault)]
• Couldn't match type ‘Int’ with ‘Bool’
Inaccessible code in
the type signature for:
g :: forall a. (Int ~ Bool) => Bool -> a
• In the ambiguity check for ‘g’
To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
In the type signature: g :: (Int ~ Bool) => Bool -> a
T15450.hs:9:7: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative: Patterns of type ‘Bool’ not matched: False
T12466a.hs:26:18: warning: [-Winaccessible-code (in -Wdefault)]
• Couldn't match type ‘a’ with ‘Gcd a b’
‘a’ is a rigid type variable bound by
the type signature for:
dividesGcd :: forall (a :: Nat) (b :: Nat) (c :: Nat).
(Divides a b, Divides a c) :- Divides a (Gcd b c)
at T12466a.hs:25:1-77
Inaccessible code in
a type expected by the context:
(a ~ Gcd a b, a ~ Gcd a c) => Dict (a ~ Gcd a (Gcd b c))
• In the first argument of ‘Sub’, namely ‘axiom’
In the expression: Sub axiom
In an equation for ‘dividesGcd’: dividesGcd = Sub axiom
• Relevant bindings include
dividesGcd :: (Divides a b, Divides a c) :- Divides a (Gcd b c)
(bound at T12466a.hs:26:1)
FDsFromGivens.hs:13:1: warning: [-Winaccessible-code (in -Wdefault)]
Couldn't match type ‘[a]’ with ‘Bool’
arising from a functional dependency between constraints:
‘C Char Bool’
arising from the type signature for:
g1 :: forall a.
(C Char [a], C Char Bool) =>
a -> () at FDsFromGivens.hs:13:1-42
‘C Char [a]’
arising from the type signature for:
g1 :: forall a.
(C Char [a], C Char Bool) =>
a -> () at FDsFromGivens.hs:13:1-42
Inaccessible code in
the type signature for:
g1 :: forall a. (C Char [a], C Char Bool) => a -> ()
FDsFromGivens.hs:13:7: warning: [-Winaccessible-code (in -Wdefault)]
• Couldn't match type ‘[a]’ with ‘Bool’
arising from a functional dependency between constraints:
‘C Char Bool’
arising from the type signature for:
g1 :: forall a.
(C Char [a], C Char Bool) =>
a -> () at FDsFromGivens.hs:13:7-42
‘C Char [a]’
arising from the type signature for:
g1 :: forall a.
(C Char [a], C Char Bool) =>
a -> () at FDsFromGivens.hs:13:7-42
Inaccessible code in
the type signature for:
g1 :: forall a. (C Char [a], C Char Bool) => a -> ()
• In the ambiguity check for ‘g1’
To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
In the type signature: g1 :: (C Char [a], C Char Bool) => a -> ()
T10715.hs:17:1: warning: [-Winaccessible-code (in -Wdefault)]
Couldn't match representation of type ‘a’ with that of ‘X a’
‘a’ is a rigid type variable bound by
the type signature for:
doCoerce :: forall a. Coercible a (X a) => a -> X a
at T10715.hs:17:1-41
Inaccessible code in
the type signature for:
doCoerce :: forall a. Coercible a (X a) => a -> X a
T10715.hs:17:13: warning: [-Winaccessible-code (in -Wdefault)]
• Couldn't match representation of type ‘a’ with that of ‘X a’
‘a’ is a rigid type variable bound by
the type signature for:
doCoerce :: forall a. Coercible a (X a) => a -> X a
at T10715.hs:17:13-41
Inaccessible code in
the type signature for:
doCoerce :: forall a. Coercible a (X a) => a -> X a
• In the ambiguity check for ‘doCoerce’
To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
In the type signature: doCoerce :: Coercible a (X a) => a -> X a
T5236.hs:16:1: warning: [-Winaccessible-code (in -Wdefault)]
Couldn't match type ‘B’ with ‘A’
arising from a functional dependency between:
constraint ‘Id A B’
arising from the type signature for:
loop :: Id A B => Bool
instance ‘Id B B’ at T5236.hs:11:10-15
Inaccessible code in
the type signature for:
loop :: Id A B => Bool
T5236.hs:16:9: warning: [-Winaccessible-code (in -Wdefault)]
• Couldn't match type ‘B’ with ‘A’
arising from a functional dependency between:
constraint ‘Id A B’
arising from the type signature for:
loop :: Id A B => Bool
instance ‘Id B B’ at T5236.hs:11:10-15
Inaccessible code in
the type signature for:
loop :: Id A B => Bool
• In the ambiguity check for ‘loop’
To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
In the type signature: loop :: Id A B => Bool
T8392a.hs:10:1: warning: [-Winaccessible-code (in -Wdefault)]
Couldn't match type ‘Int’ with ‘Bool’
Inaccessible code in
the type signature for:
foo :: forall a. (Int ~ Bool) => a -> a
tcfail085.hs:9:5:
Constructor ‘F’ does not have the required strict field(s): y
In the expression: F {x = 2}
In an equation for ‘z’: z = F {x = 2}
tcfail085.hs:9:5: error:
Constructor ‘F’ does not have the required strict field(s): y
In the expression: F {x = 2}
In an equation for ‘z’: z = F {x = 2}
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