[Git][ghc/ghc][wip/T26115] 3 commits: Error message changes
Simon Peyton Jones pushed to branch wip/T26115 at Glasgow Haskell Compiler / GHC Commits: 553b9080 by Simon Peyton Jones at 2025-07-17T17:09:47+01:00 Error message changes - - - - - 91333dbb by Simon Peyton Jones at 2025-07-17T17:09:47+01:00 Document use of TrySolveImplication (SF6) - - - - - 3a32ba49 by Simon Peyton Jones at 2025-07-17T17:09:47+01:00 Improve solveOneFromTheOther ...to account for rewriter sets - - - - - 10 changed files: - compiler/GHC/Tc/Solver/Equality.hs - compiler/GHC/Tc/Solver/InertSet.hs - testsuite/tests/deriving/should_fail/T12768.stderr - testsuite/tests/deriving/should_fail/T1496.stderr - testsuite/tests/deriving/should_fail/T5498.stderr - testsuite/tests/deriving/should_fail/T7148.stderr - testsuite/tests/deriving/should_fail/T7148a.stderr - testsuite/tests/roles/should_fail/RolesIArray.stderr - + testsuite/tests/simplCore/should_compile/T2117.hs - + testsuite/tests/simplCore/should_compile/T26117.stderr Changes: ===================================== compiler/GHC/Tc/Solver/Equality.hs ===================================== @@ -532,6 +532,8 @@ can_eq_nc_forall ev eq_rel s1 s2 unifyForAllBody ev (eqRelRole eq_rel) $ \uenv -> go uenv skol_tvs init_subst2 bndrs1 bndrs2 + -- Solve the implication right away, using `trySolveImplication` + -- See (SF6) in Note [Solving forall equalities] ; traceTcS "Trying to solve the implication" (ppr s1 $$ ppr s2 $$ ppr wanteds) ; ev_binds_var <- newNoTcEvBinds ; solved <- trySolveImplication $ @@ -620,6 +622,21 @@ There are lots of wrinkles of course: especially Refl ones. We use the `unifyForAllBody` wrapper for `uType`, because we want to /gather/ the equality constraint (to put in the implication) rather than /emit/ them into the monad, as `wrapUnifierTcS` does. + +(SF6) We solve the implication on the spot, using `trySolveImplication`. In + the past we instead generated an `Implication` to be solved later. Nice in + some ways but it added complexity: + - We needed a `wl_implics` field of `WorkList` to collect + these emitted implications + - The types of `solveSimpleWanteds` and friends were more complicated + - Trickily, an `EvFun` had to contain an `EvBindsVar` ref-cell, which made + `evVarsOfTerm` harder. Now an `EvFun` just contains the bindings. + The disadvantage of solve-on-the-spot is that if we fail we are simply + left with an unsolved (forall a. blah) ~ (forall b. blah), and it may + not be clear /why we couldn't solve it. But on balance the error messages + improve: it is easier to undertand that + (forall a. a->a) ~ (forall b. b->Int) + is insoluble than it is to understand a message about matching `a` with `Int`. -} {- Note [Unwrap newtypes first] @@ -2706,7 +2723,7 @@ tryInertEqs :: EqCt -> SolverStage () tryInertEqs work_item@(EqCt { eq_ev = ev, eq_eq_rel = eq_rel }) = Stage $ do { inerts <- getInertCans - ; if | Just (ev_i, swapped) <- inertsCanDischarge inerts work_item + ; if | Just (ev_i, swapped) <- inertsEqsCanDischarge inerts work_item -> do { setEvBindIfWanted ev EvCanonical $ evCoercion (maybeSymCo swapped $ downgradeRole (eqRelRole eq_rel) @@ -2717,10 +2734,10 @@ tryInertEqs work_item@(EqCt { eq_ev = ev, eq_eq_rel = eq_rel }) | otherwise -> continueWith () } -inertsCanDischarge :: InertCans -> EqCt - -> Maybe ( CtEvidence -- The evidence for the inert - , SwapFlag ) -- Whether we need mkSymCo -inertsCanDischarge inerts (EqCt { eq_lhs = lhs_w, eq_rhs = rhs_w +inertsEqsCanDischarge :: InertCans -> EqCt + -> Maybe ( CtEvidence -- The evidence for the inert + , SwapFlag ) -- Whether we need mkSymCo +inertsEqsCanDischarge inerts (EqCt { eq_lhs = lhs_w, eq_rhs = rhs_w , eq_ev = ev_w, eq_eq_rel = eq_rel }) | (ev_i : _) <- [ ev_i | EqCt { eq_ev = ev_i, eq_rhs = rhs_i , eq_eq_rel = eq_rel } @@ -2766,7 +2783,7 @@ inertsCanDischarge inerts (EqCt { eq_lhs = lhs_w, eq_rhs = rhs_w -- Prefer the one that has no rewriters -- See (CE4) in Note [Combining equalities] -inertsCanDischarge _ _ = Nothing +inertsEqsCanDischarge _ _ = Nothing ===================================== compiler/GHC/Tc/Solver/InertSet.hs ===================================== @@ -1960,6 +1960,9 @@ solveOneFromTheOther :: Ct -- Inert (Dict or Irred) -- We can always solve one from the other: even if both are wanted, -- although we don't rewrite wanteds with wanteds, we can combine -- two wanteds into one by solving one from the other +-- +-- Compare the corresponding function for equalities: +-- GHC.Tc.Solver.Equality.inertEqsCanDischarge solveOneFromTheOther ct_i ct_w | CtWanted {} <- ev_w @@ -1968,32 +1971,37 @@ solveOneFromTheOther ct_i ct_w = -- Inert must be Given KeepWork - | CtWanted {} <- ev_w + | CtWanted (WantedCt { ctev_rewriters = rw_w }) <- ev_w = -- Inert is Given or Wanted case ev_i of CtGiven {} -> KeepInert -- work is Wanted; inert is Given: easy choice. - CtWanted {} -- Both are Wanted + CtWanted (WantedCt { ctev_rewriters = rw_i }) -- Both are Wanted -- If only one has no pending superclasses, use it -- Otherwise we can get infinite superclass expansion (#22516) -- in silly cases like class C T b => C a b where ... - | not is_psc_i, is_psc_w -> KeepInert - | is_psc_i, not is_psc_w -> KeepWork + | Just res <- better (not is_psc_i) (not is_psc_w) + -> res + + -- If only one has an empty rewriter set, use it + | Just res <- better (isEmptyRewriterSet rw_i) (isEmptyRewriterSet rw_w) + -> res -- If only one is a WantedSuperclassOrigin (arising from expanding -- a Wanted class constraint), keep the other: wanted superclasses -- may be unexpected by users - | not is_wsc_orig_i, is_wsc_orig_w -> KeepInert - | is_wsc_orig_i, not is_wsc_orig_w -> KeepWork + | Just res <- better (not is_wsc_orig_i) (not is_wsc_orig_w) + -> res - -- otherwise, just choose the lower span + -- Otherwise, just choose the lower span -- reason: if we have something like (abs 1) (where the -- Num constraint cannot be satisfied), it's better to -- get an error about abs than about 1. -- This test might become more elaborate if we see an -- opportunity to improve the error messages | ((<) `on` ctLocSpan) loc_i loc_w -> KeepInert + | otherwise -> KeepWork -- From here on the work-item is Given @@ -2016,6 +2024,15 @@ solveOneFromTheOther ct_i ct_w | otherwise -- Both are Given, levels differ = different_level_strategy where + better :: Bool -> Bool -> Maybe InteractResult + -- (better inert-is-good wanted-is-good) returns + -- Just KeepWork if wanted is strictly better than inert + -- Just KeepInert if inert is strictly better than wanted + -- Nothing if they are the same + better True False = Just KeepInert + better False True = Just KeepWork + better _ _ = Nothing + ev_i = ctEvidence ct_i ev_w = ctEvidence ct_w ===================================== testsuite/tests/deriving/should_fail/T12768.stderr ===================================== @@ -1,10 +1,9 @@ -T12768.hs:9:33: error: [GHC-39999] - • Could not deduce ‘D [a]’ - arising from the head of a quantified constraint +T12768.hs:9:33: error: [GHC-05617] + • Could not deduce ‘D (N a) => + (Coercible ([a] -> [a]) (N a -> N a), D [a])’ arising from the coercion of the method ‘op’ from type ‘D [a] => [a] -> [a]’ to type ‘D (N a) => N a -> N a’ from the context: C a bound by the deriving clause for ‘C (N a)’ at T12768.hs:9:33 - or from: D (N a) bound by a quantified context at T12768.hs:9:33 • When deriving the instance for (C (N a)) ===================================== testsuite/tests/deriving/should_fail/T1496.stderr ===================================== @@ -1,11 +1,8 @@ -T1496.hs:10:32: error: [GHC-18872] - • Couldn't match representation of type: c Int - with that of: c Moo - arising from the head of a quantified constraint +T1496.hs:10:32: error: [GHC-05617] + • Could not solve: ‘forall (c :: * -> *). + Coercible (c Int -> c Int) (c Int -> c Moo)’ arising from the coercion of the method ‘isInt’ from type ‘forall (c :: * -> *). c Int -> c Int’ to type ‘forall (c :: * -> *). c Int -> c Moo’ - Note: We cannot know what roles the parameters to ‘c’ have; - we must assume that the role is nominal. • When deriving the instance for (IsInt Moo) ===================================== testsuite/tests/deriving/should_fail/T5498.stderr ===================================== @@ -1,11 +1,11 @@ -T5498.hs:30:39: error: [GHC-18872] - • Couldn't match representation of type: c a - with that of: c (Down a) - arising from the head of a quantified constraint +T5498.hs:30:39: error: [GHC-05617] + • Could not deduce ‘forall (c :: * -> *). + Coercible (c a -> c Int) (c (Down a) -> c Int)’ arising from the coercion of the method ‘intIso’ from type ‘forall (c :: * -> *). c a -> c Int’ to type ‘forall (c :: * -> *). c (Down a) -> c Int’ - Note: We cannot know what roles the parameters to ‘c’ have; - we must assume that the role is nominal. + from the context: IntIso a + bound by the deriving clause for ‘IntIso (Down a)’ + at T5498.hs:30:39-44 • When deriving the instance for (IntIso (Down a)) ===================================== testsuite/tests/deriving/should_fail/T7148.stderr ===================================== @@ -1,22 +1,13 @@ -T7148.hs:27:40: error: [GHC-25897] - • Couldn't match type ‘b’ with ‘Tagged a b’ - arising from the head of a quantified constraint - arising from the coercion of the method ‘iso2’ - from type ‘forall b1. SameType b1 () -> SameType b1 b’ - to type ‘forall b1. SameType b1 () -> SameType b1 (Tagged a b)’ - ‘b’ is a rigid type variable bound by - the deriving clause for ‘IsoUnit (Tagged a b)’ - at T7148.hs:27:40-46 - • When deriving the instance for (IsoUnit (Tagged a b)) - -T7148.hs:27:40: error: [GHC-25897] - • Couldn't match type ‘b’ with ‘Tagged a b’ - arising from the head of a quantified constraint +T7148.hs:27:40: error: [GHC-05617] + • Could not deduce ‘forall b1. + Coercible + (SameType () b1 -> SameType b b1) + (SameType () b1 -> SameType (Tagged a b) b1)’ arising from the coercion of the method ‘iso1’ from type ‘forall b1. SameType () b1 -> SameType b b1’ to type ‘forall b1. SameType () b1 -> SameType (Tagged a b) b1’ - ‘b’ is a rigid type variable bound by - the deriving clause for ‘IsoUnit (Tagged a b)’ + from the context: IsoUnit b + bound by the deriving clause for ‘IsoUnit (Tagged a b)’ at T7148.hs:27:40-46 • When deriving the instance for (IsoUnit (Tagged a b)) ===================================== testsuite/tests/deriving/should_fail/T7148a.stderr ===================================== @@ -1,13 +1,13 @@ -T7148a.hs:19:50: error: [GHC-10283] - • Couldn't match representation of type ‘b’ - with that of ‘Result a b’ - arising from the head of a quantified constraint +T7148a.hs:19:50: error: [GHC-05617] + • Could not deduce ‘forall b. + Coercible + (Proxy b -> a -> Result a b) (Proxy b -> IS_NO_LONGER a -> b)’ arising from the coercion of the method ‘coerce’ from type ‘forall b. Proxy b -> a -> Result a b’ to type ‘forall b. Proxy b -> IS_NO_LONGER a -> Result (IS_NO_LONGER a) b’ - ‘b’ is a rigid type variable bound by - a quantified context + from the context: Convert a + bound by the deriving clause for ‘Convert (IS_NO_LONGER a)’ at T7148a.hs:19:50-56 • When deriving the instance for (Convert (IS_NO_LONGER a)) ===================================== testsuite/tests/roles/should_fail/RolesIArray.stderr ===================================== @@ -1,68 +1,8 @@ -RolesIArray.hs:10:13: error: [GHC-18872] - • Couldn't match type ‘Word64’ with ‘N’ - arising from the head of a quantified constraint - arising from the coercion of the method ‘Data.Array.Base.unsafeAccumArray’ - from type ‘forall i e'. - Ix i => - (Word64 -> e' -> Word64) - -> Word64 -> (i, i) -> [(Int, e')] -> UArray i Word64’ - to type ‘forall i e'. - Ix i => - (N -> e' -> N) -> N -> (i, i) -> [(Int, e')] -> UArray i N’ - • When deriving the instance for (IArray UArray N) - -RolesIArray.hs:10:13: error: [GHC-18872] - • Couldn't match type ‘Word64’ with ‘N’ - arising from the head of a quantified constraint - arising from the coercion of the method ‘Data.Array.Base.unsafeAccum’ - from type ‘forall i e'. - Ix i => - (Word64 -> e' -> Word64) - -> UArray i Word64 -> [(Int, e')] -> UArray i Word64’ - to type ‘forall i e'. - Ix i => - (N -> e' -> N) -> UArray i N -> [(Int, e')] -> UArray i N’ - • When deriving the instance for (IArray UArray N) - -RolesIArray.hs:10:13: error: [GHC-18872] - • Couldn't match type ‘Word64’ with ‘N’ - arising from the head of a quantified constraint - arising from the coercion of the method ‘Data.Array.Base.unsafeReplace’ - from type ‘forall i. - Ix i => - UArray i Word64 -> [(Int, Word64)] -> UArray i Word64’ - to type ‘forall i. Ix i => UArray i N -> [(Int, N)] -> UArray i N’ - • When deriving the instance for (IArray UArray N) - -RolesIArray.hs:10:13: error: [GHC-18872] - • Couldn't match type ‘Word64’ with ‘N’ - arising from the head of a quantified constraint - arising from the coercion of the method ‘Data.Array.Base.unsafeAt’ - from type ‘forall i. Ix i => UArray i Word64 -> Int -> Word64’ - to type ‘forall i. Ix i => UArray i N -> Int -> N’ - • When deriving the instance for (IArray UArray N) - -RolesIArray.hs:10:13: error: [GHC-18872] - • Couldn't match type ‘Word64’ with ‘N’ - arising from the head of a quantified constraint - arising from the coercion of the method ‘Data.Array.Base.unsafeArray’ - from type ‘forall i. - Ix i => - (i, i) -> [(Int, Word64)] -> UArray i Word64’ - to type ‘forall i. Ix i => (i, i) -> [(Int, N)] -> UArray i N’ - • When deriving the instance for (IArray UArray N) - -RolesIArray.hs:10:13: error: [GHC-18872] - • Couldn't match type ‘Word64’ with ‘N’ - arising from the head of a quantified constraint - arising from the coercion of the method ‘Data.Array.Base.numElements’ - from type ‘forall i. Ix i => UArray i Word64 -> Int’ - to type ‘forall i. Ix i => UArray i N -> Int’ - • When deriving the instance for (IArray UArray N) - -RolesIArray.hs:10:13: error: [GHC-18872] - • Couldn't match type ‘Word64’ with ‘N’ - arising from the head of a quantified constraint +RolesIArray.hs:10:13: error: [GHC-05617] + • Could not solve: ‘forall i. + Ix i => + (Coercible (UArray i Word64 -> (i, i)) (UArray i N -> (i, i)), + Ix i)’ arising from the coercion of the method ‘bounds’ from type ‘forall i. Ix i => UArray i Word64 -> (i, i)’ to type ‘forall i. Ix i => UArray i N -> (i, i)’ ===================================== testsuite/tests/simplCore/should_compile/T2117.hs ===================================== @@ -0,0 +1,15 @@ +{-# LANGUAGE UndecidableInstances, TypeFamilies #-} + +module T26117 where + +type family F a +type instance F Int = Bool + +class Eq (F a) => D a b where { dop1, dop2 :: a -> b -> b } + +class C a b where { op1,op2 :: F a -> a -> b -> Int } + +instance (Eq (F a), D a b) => C a [b] where + op1 x _ _ | x==x = 3 + | otherwise = 4 + {-# SPECIALISE instance D Int b => C Int [b] #-} ===================================== testsuite/tests/simplCore/should_compile/T26117.stderr ===================================== @@ -0,0 +1,433 @@ +T26117.hs:17:10: warning: [GHC-06201] [-Wmissing-methods (in -Wdefault)] + • No explicit implementation for + ‘op2’ + • In the instance declaration for ‘C a [b]’ + + +==================== Tidy Core ==================== +Result size of Tidy Core + = {terms: 196, types: 296, coercions: 2, joins: 0/0} + +-- RHS size: {terms: 7, types: 18, coercions: 0, joins: 0/0} +op1 [InlPrag=[~]] :: forall a b. C a b => F a -> a -> b -> Int +[GblId[ClassOp], + Arity=1, + Str=<S!P(SL,A)>, + Unf=Unf{Src=StableSystem, TopLvl=True, + Value=True, ConLike=True, WorkFree=True, Expandable=True, + Guidance=ALWAYS_IF(arity=1,unsat_ok=False,boring_ok=False) + Tmpl= \ (@a) (@b) (v [Occ=Once1!] :: C a b) -> + case v of { T26117.C:C v2 [Occ=Once1] _ [Occ=Dead] -> v2 }}] +op1 + = \ (@a) (@b) (v :: C a b) -> + case v of v1 { T26117.C:C v2 v3 -> v2 } + +-- RHS size: {terms: 7, types: 18, coercions: 0, joins: 0/0} +op2 [InlPrag=[~]] :: forall a b. C a b => F a -> a -> b -> Int +[GblId[ClassOp], + Arity=1, + Str=<S!P(A,SL)>, + Unf=Unf{Src=StableSystem, TopLvl=True, + Value=True, ConLike=True, WorkFree=True, Expandable=True, + Guidance=ALWAYS_IF(arity=1,unsat_ok=False,boring_ok=False) + Tmpl= \ (@a) (@b) (v [Occ=Once1!] :: C a b) -> + case v of { T26117.C:C _ [Occ=Dead] v3 [Occ=Once1] -> v3 }}] +op2 + = \ (@a) (@b) (v :: C a b) -> + case v of v1 { T26117.C:C v2 v3 -> v3 } + +-- RHS size: {terms: 7, types: 17, coercions: 0, joins: 0/0} +T26117.$p1D [InlPrag=[~]] :: forall a b. D a b => Eq (F a) +[GblId[ClassOp], + Arity=1, + Str=<S!P(SL,A,A)>, + Unf=Unf{Src=StableSystem, TopLvl=True, + Value=True, ConLike=True, WorkFree=True, Expandable=True, + Guidance=ALWAYS_IF(arity=1,unsat_ok=False,boring_ok=False) + Tmpl= \ (@a) (@b) (v [Occ=Once1!] :: D a b) -> + case v of { T26117.C:D v2 [Occ=Once1] _ [Occ=Dead] _ [Occ=Dead] -> + v2 + }}] +T26117.$p1D + = \ (@a) (@b) (v :: D a b) -> + case v of v1 { T26117.C:D v2 v3 v4 -> v2 } + +-- RHS size: {terms: 7, types: 17, coercions: 0, joins: 0/0} +dop1 [InlPrag=[~]] :: forall a b. D a b => a -> b -> b +[GblId[ClassOp], + Arity=1, + Str=<S!P(A,SL,A)>, + Unf=Unf{Src=StableSystem, TopLvl=True, + Value=True, ConLike=True, WorkFree=True, Expandable=True, + Guidance=ALWAYS_IF(arity=1,unsat_ok=False,boring_ok=False) + Tmpl= \ (@a) (@b) (v [Occ=Once1!] :: D a b) -> + case v of { T26117.C:D _ [Occ=Dead] v3 [Occ=Once1] _ [Occ=Dead] -> + v3 + }}] +dop1 + = \ (@a) (@b) (v :: D a b) -> + case v of v1 { T26117.C:D v2 v3 v4 -> v3 } + +-- RHS size: {terms: 7, types: 17, coercions: 0, joins: 0/0} +dop2 [InlPrag=[~]] :: forall a b. D a b => a -> b -> b +[GblId[ClassOp], + Arity=1, + Str=<S!P(A,A,SL)>, + Unf=Unf{Src=StableSystem, TopLvl=True, + Value=True, ConLike=True, WorkFree=True, Expandable=True, + Guidance=ALWAYS_IF(arity=1,unsat_ok=False,boring_ok=False) + Tmpl= \ (@a) (@b) (v [Occ=Once1!] :: D a b) -> + case v of { T26117.C:D _ [Occ=Dead] _ [Occ=Dead] v4 [Occ=Once1] -> + v4 + }}] +dop2 + = \ (@a) (@b) (v :: D a b) -> + case v of v1 { T26117.C:D v2 v3 v4 -> v4 } + +-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +T26117.$fCaList1 :: GHC.Internal.Prim.Addr# +[GblId, + Unf=Unf{Src=<vanilla>, TopLvl=True, + Value=True, ConLike=True, WorkFree=True, Expandable=True, + Guidance=IF_ARGS [] 70 0}] +T26117.$fCaList1 = "T26117.hs:17:10-37|\CANop2\EM"# + +-- RHS size: {terms: 6, types: 15, coercions: 0, joins: 0/0} +T26117.$fCaList_$cop2 [InlPrag=[2]] + :: forall a b. (Eq (F a), D a b) => F a -> a -> [b] -> Int +[GblId, + Arity=2, + Str=<B><B>b, + Cpr=b, + Unf=Unf{Src=StableSystem, TopLvl=True, + Value=True, ConLike=True, WorkFree=True, Expandable=True, + Guidance=ALWAYS_IF(arity=2,unsat_ok=True,boring_ok=True) + Tmpl= \ (@a) (@b) _ [Occ=Dead] _ [Occ=Dead] -> + GHC.Internal.Control.Exception.Base.noMethodBindingError + @GHC.Internal.Types.LiftedRep + @(F a -> a -> [b] -> Int) + T26117.$fCaList1}] +T26117.$fCaList_$cop2 + = \ (@a) (@b) _ [Occ=Dead] _ [Occ=Dead] -> + GHC.Internal.Control.Exception.Base.noMethodBindingError + @GHC.Internal.Types.LiftedRep + @(F a -> a -> [b] -> Int) + T26117.$fCaList1 + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +T26117.$fCaList3 :: Int +[GblId, + Unf=Unf{Src=<vanilla>, TopLvl=True, + Value=True, ConLike=True, WorkFree=True, Expandable=True, + Guidance=IF_ARGS [] 10 10}] +T26117.$fCaList3 = GHC.Internal.Types.I# 4# + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +T26117.$fCaList2 :: Int +[GblId, + Unf=Unf{Src=<vanilla>, TopLvl=True, + Value=True, ConLike=True, WorkFree=True, Expandable=True, + Guidance=IF_ARGS [] 10 10}] +T26117.$fCaList2 = GHC.Internal.Types.I# 3# + +-- RHS size: {terms: 8, types: 7, coercions: 2, joins: 0/0} +lvl :: forall b. F Int -> Int -> [b] -> Int +[GblId, Arity=3, Str=<1A><A><A>, Cpr=1, Unf=OtherCon []] +lvl + = \ (@b) (x :: F Int) _ [Occ=Dead] _ [Occ=Dead] -> + case x `cast` (Sub T26117.D:R:FInt :: F Int ~R# Bool) of lwild + { __DEFAULT -> + T26117.$fCaList2 + } + +-- RHS size: {terms: 3, types: 8, coercions: 0, joins: 0/0} +lvl1 :: forall b. F Int -> Int -> [b] -> Int +[GblId, Str=b, Cpr=b] +lvl1 + = \ (@b) -> + GHC.Internal.Control.Exception.Base.noMethodBindingError + @GHC.Internal.Types.LiftedRep + @(F Int -> Int -> [b] -> Int) + T26117.$fCaList1 + +-- RHS size: {terms: 4, types: 6, coercions: 0, joins: 0/0} +lvl2 :: forall b. C Int [b] +[GblId, Unf=OtherCon []] +lvl2 = \ (@b) -> T26117.C:C @Int @[b] (lvl @b) (lvl1 @b) + +-- RHS size: {terms: 3, types: 5, coercions: 0, joins: 0/0} +T26117.$fCaList_$s$fCaList [InlPrag=CONLIKE] + :: forall b. D Int b => C Int [b] +[GblId[DFunId], + Arity=1, + Str=<A>, + Unf=DFun: \ (@b) ($dD :: D Int b) -> + T26117.C:C TYPE: Int + TYPE: [b] + \ (x :: F Int) _ [Occ=Dead] _ [Occ=Dead] -> + case GHC.Internal.Prim.dataToTagSmall# + @GHC.Internal.Types.Lifted + @Bool + (x `cast` (Sub T26117.D:R:FInt :: F Int ~R# Bool)) + of a# [Occ=Once1] + { __DEFAULT -> + case GHC.Internal.Prim.dataToTagSmall# + @GHC.Internal.Types.Lifted + @Bool + (x `cast` (Sub T26117.D:R:FInt :: F Int ~R# Bool)) + of b# [Occ=Once1] + { __DEFAULT -> + case GHC.Internal.Prim.==# a# b# of { + __DEFAULT -> GHC.Internal.Types.I# 4#; + 1# -> GHC.Internal.Types.I# 3# + } + } + } + GHC.Internal.Control.Exception.Base.noMethodBindingError + @GHC.Internal.Types.LiftedRep + @(F Int -> Int -> [b] -> Int) + "T26117.hs:17:10-37|\CANop2\EM"#] +T26117.$fCaList_$s$fCaList = \ (@b) _ [Occ=Dead] -> lvl2 @b + +-- RHS size: {terms: 4, types: 9, coercions: 0, joins: 0/0} +lvl3 :: forall b a. F a -> a -> [b] -> Int +[GblId, Str=b, Cpr=b] +lvl3 + = \ (@b) (@a) -> + GHC.Internal.Control.Exception.Base.noMethodBindingError + @GHC.Internal.Types.LiftedRep + @(F a -> a -> [b] -> Int) + T26117.$fCaList1 + +-- RHS size: {terms: 18, types: 21, coercions: 0, joins: 0/0} +T26117.$fCaList [InlPrag=CONLIKE] + :: forall a b. (Eq (F a), D a b) => C a [b] +[GblId[DFunId], + Arity=2, + Str=<LP(SC(S,C(1,L)),A)><A>, + Unf=DFun: \ (@a) (@b) (v :: Eq (F a)) (v1 :: D a b) -> + T26117.C:C TYPE: a + TYPE: [b] + \ (x :: F a) _ [Occ=Dead] _ [Occ=Dead] -> + case == @(F a) v x x of { + False -> T26117.$fCaList3; + True -> T26117.$fCaList2 + } + T26117.$fCaList_$cop2 @a @b v v1] +T26117.$fCaList + = \ (@a) (@b) ($dEq :: Eq (F a)) _ [Occ=Dead] -> + T26117.C:C + @a + @[b] + (\ (x :: F a) _ [Occ=Dead] _ [Occ=Dead] -> + case == @(F a) $dEq x x of { + False -> T26117.$fCaList3; + True -> T26117.$fCaList2 + }) + (lvl3 @b @a) + +-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +T26117.$trModule4 :: GHC.Internal.Prim.Addr# +[GblId, + Unf=Unf{Src=<vanilla>, TopLvl=True, + Value=True, ConLike=True, WorkFree=True, Expandable=True, + Guidance=IF_ARGS [] 20 0}] +T26117.$trModule4 = "main"# + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +T26117.$trModule3 :: GHC.Internal.Types.TrName +[GblId, + Unf=Unf{Src=<vanilla>, TopLvl=True, + Value=True, ConLike=True, WorkFree=True, Expandable=True, + Guidance=IF_ARGS [] 10 10}] +T26117.$trModule3 = GHC.Internal.Types.TrNameS T26117.$trModule4 + +-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +T26117.$trModule2 :: GHC.Internal.Prim.Addr# +[GblId, + Unf=Unf{Src=<vanilla>, TopLvl=True, + Value=True, ConLike=True, WorkFree=True, Expandable=True, + Guidance=IF_ARGS [] 30 0}] +T26117.$trModule2 = "T26117"# + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +T26117.$trModule1 :: GHC.Internal.Types.TrName +[GblId, + Unf=Unf{Src=<vanilla>, TopLvl=True, + Value=True, ConLike=True, WorkFree=True, Expandable=True, + Guidance=IF_ARGS [] 10 10}] +T26117.$trModule1 = GHC.Internal.Types.TrNameS T26117.$trModule2 + +-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0} +T26117.$trModule :: GHC.Internal.Types.Module +[GblId, + Unf=Unf{Src=<vanilla>, TopLvl=True, + Value=True, ConLike=True, WorkFree=True, Expandable=True, + Guidance=IF_ARGS [] 10 10}] +T26117.$trModule + = GHC.Internal.Types.Module T26117.$trModule3 T26117.$trModule1 + +-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0} +$krep :: GHC.Internal.Types.KindRep +[GblId, Unf=OtherCon []] +$krep + = GHC.Internal.Types.KindRepFun + GHC.Internal.Types.krep$* GHC.Internal.Types.krep$Constraint + +-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0} +T26117.$tcC1 [InlPrag=[~]] :: GHC.Internal.Types.KindRep +[GblId, Unf=OtherCon []] +T26117.$tcC1 + = GHC.Internal.Types.KindRepFun GHC.Internal.Types.krep$* $krep + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +$krep1 :: GHC.Internal.Types.KindRep +[GblId, Unf=OtherCon []] +$krep1 = GHC.Internal.Types.KindRepVar 1# + +-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0} +$krep2 :: GHC.Internal.Types.KindRep +[GblId, Unf=OtherCon []] +$krep2 = GHC.Internal.Types.KindRepFun $krep1 $krep1 + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +$krep3 :: GHC.Internal.Types.KindRep +[GblId, Unf=OtherCon []] +$krep3 = GHC.Internal.Types.KindRepVar 0# + +-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0} +$krep4 :: GHC.Internal.Types.KindRep +[GblId, Unf=OtherCon []] +$krep4 = GHC.Internal.Types.KindRepFun $krep3 $krep2 + +-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +T26117.$tcD2 :: GHC.Internal.Prim.Addr# +[GblId, + Unf=Unf{Src=<vanilla>, TopLvl=True, + Value=True, ConLike=True, WorkFree=True, Expandable=True, + Guidance=IF_ARGS [] 20 0}] +T26117.$tcD2 = "D"# + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +T26117.$tcD1 :: GHC.Internal.Types.TrName +[GblId, + Unf=Unf{Src=<vanilla>, TopLvl=True, + Value=True, ConLike=True, WorkFree=True, Expandable=True, + Guidance=IF_ARGS [] 10 10}] +T26117.$tcD1 = GHC.Internal.Types.TrNameS T26117.$tcD2 + +-- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0} +T26117.$tcD :: GHC.Internal.Types.TyCon +[GblId, + Unf=Unf{Src=<vanilla>, TopLvl=True, + Value=True, ConLike=True, WorkFree=True, Expandable=True, + Guidance=IF_ARGS [] 10 10}] +T26117.$tcD + = GHC.Internal.Types.TyCon + 18427868686024955676#Word64 + 4087453451394481638#Word64 + T26117.$trModule + T26117.$tcD1 + 0# + T26117.$tcC1 + +-- RHS size: {terms: 3, types: 2, coercions: 0, joins: 0/0} +$krep5 :: [GHC.Internal.Types.KindRep] +[GblId, Unf=OtherCon []] +$krep5 + = GHC.Internal.Types.: + @GHC.Internal.Types.KindRep + $krep1 + (GHC.Internal.Types.[] @GHC.Internal.Types.KindRep) + +-- RHS size: {terms: 3, types: 1, coercions: 0, joins: 0/0} +$krep6 :: [GHC.Internal.Types.KindRep] +[GblId, Unf=OtherCon []] +$krep6 + = GHC.Internal.Types.: @GHC.Internal.Types.KindRep $krep3 $krep5 + +-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0} +$krep7 :: GHC.Internal.Types.KindRep +[GblId, Unf=OtherCon []] +$krep7 = GHC.Internal.Types.KindRepTyConApp T26117.$tcD $krep6 + +-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0} +$krep8 :: GHC.Internal.Types.KindRep +[GblId, Unf=OtherCon []] +$krep8 = GHC.Internal.Types.KindRepFun $krep4 $krep7 + +-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0} +T26117.$tc'C:D1 [InlPrag=[~]] :: GHC.Internal.Types.KindRep +[GblId, Unf=OtherCon []] +T26117.$tc'C:D1 = GHC.Internal.Types.KindRepFun $krep4 $krep8 + +-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +T26117.$tc'C:D3 :: GHC.Internal.Prim.Addr# +[GblId, + Unf=Unf{Src=<vanilla>, TopLvl=True, + Value=True, ConLike=True, WorkFree=True, Expandable=True, + Guidance=IF_ARGS [] 20 0}] +T26117.$tc'C:D3 = "'C:D"# + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +T26117.$tc'C:D2 :: GHC.Internal.Types.TrName +[GblId, + Unf=Unf{Src=<vanilla>, TopLvl=True, + Value=True, ConLike=True, WorkFree=True, Expandable=True, + Guidance=IF_ARGS [] 10 10}] +T26117.$tc'C:D2 = GHC.Internal.Types.TrNameS T26117.$tc'C:D3 + +-- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0} +T26117.$tc'C:D :: GHC.Internal.Types.TyCon +[GblId, + Unf=Unf{Src=<vanilla>, TopLvl=True, + Value=True, ConLike=True, WorkFree=True, Expandable=True, + Guidance=IF_ARGS [] 10 10}] +T26117.$tc'C:D + = GHC.Internal.Types.TyCon + 14714477993590114477#Word64 + 17388374250742016296#Word64 + T26117.$trModule + T26117.$tc'C:D2 + 2# + T26117.$tc'C:D1 + +-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +T26117.$tcC3 :: GHC.Internal.Prim.Addr# +[GblId, + Unf=Unf{Src=<vanilla>, TopLvl=True, + Value=True, ConLike=True, WorkFree=True, Expandable=True, + Guidance=IF_ARGS [] 20 0}] +T26117.$tcC3 = "C"# + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +T26117.$tcC2 :: GHC.Internal.Types.TrName +[GblId, + Unf=Unf{Src=<vanilla>, TopLvl=True, + Value=True, ConLike=True, WorkFree=True, Expandable=True, + Guidance=IF_ARGS [] 10 10}] +T26117.$tcC2 = GHC.Internal.Types.TrNameS T26117.$tcC3 + +-- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0} +T26117.$tcC :: GHC.Internal.Types.TyCon +[GblId, + Unf=Unf{Src=<vanilla>, TopLvl=True, + Value=True, ConLike=True, WorkFree=True, Expandable=True, + Guidance=IF_ARGS [] 10 10}] +T26117.$tcC + = GHC.Internal.Types.TyCon + 6116531860557468422#Word64 + 17953227584944457497#Word64 + T26117.$trModule + T26117.$tcC2 + 0# + T26117.$tcC1 + + +------ Local rules for imported ids -------- +"USPEC $fCaList @Int @_" + forall (@b) ($dD :: D Int b) ($dEq :: Eq (F Int)). + T26117.$fCaList @Int @b $dEq $dD + = T26117.$fCaList_$s$fCaList @b $dD + + View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c8241b8a27c5682347d3923453996aa... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c8241b8a27c5682347d3923453996aa... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Simon Peyton Jones (@simonpj)