Simon Peyton Jones pushed to branch wip/spj-try-opt-coercion at Glasgow Haskell Compiler / GHC Commits: 6ed99365 by Simon Peyton Jones at 2026-05-04T23:04:17+01:00 Fix warning - - - - - 1 changed file: - compiler/GHC/Core/Coercion/Opt.hs Changes: ===================================== compiler/GHC/Core/Coercion/Opt.hs ===================================== @@ -354,10 +354,13 @@ opt_co_refl subst co -- See Note [Optimising TransCo sequences] go co@(TransCo {}) = gobble gs0 out_cos where - out_cos :: [OutCoercion] -- None of these are TransCos - out_cos@(out_co1:_) = get_in co [] - gs0 = GS (mkReflCo role lk) tm0 - tm0 = insertTM lk gs0 emptyTM + out_cos :: [OutCoercion] -- None of these are TransCos, and the list non-empty + out_cos = get_in co [] + out_co1 = case out_cos of + (co1:_) -> co1 + [] -> pprPanic "gobble" (ppr co) + gs0 = GS (mkReflCo role lk) tm0 + tm0 = insertTM lk gs0 emptyTM lk = coercionLKind out_co1 role = coercionRole out_co1 @@ -396,18 +399,17 @@ When composing co_i, if coercionRKind( co_i ) is the same as any earlier type in the chain, we want to discard it and simply revert to the GobbleState of that earlier point. -So a GobbleState has +A GobbleState gs_k consists of: * The coercion so far: a coercion equivalent to (co1;co2;cok) * A map from types to all earlier GobbleStates, thus tyR_i :-> gs_i - where (INVARIANT) tyR_i is the coercionRKind of gs_i + where (INVARIANT) tyR_i is the coercionRKind of co_i stored in gs_i Wrinkles: * Wart: the TypeMap is (currently) multiplicity-sensitive so we might miss a possible TransCo optimisation. - -} optUnivCo :: UnivCoProvenance -> [Coercion] View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6ed9936560e28687abddbc292a265366... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6ed9936560e28687abddbc292a265366... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Simon Peyton Jones (@simonpj)