[Git][ghc/ghc][wip/T26746] Wibble
Simon Peyton Jones pushed to branch wip/T26746 at Glasgow Haskell Compiler / GHC Commits: aed32875 by Simon Peyton Jones at 2026-01-13T17:26:49+00:00 Wibble - - - - - 2 changed files: - compiler/GHC/Tc/Instance/Family.hs - compiler/GHC/Tc/Solver/Equality.hs Changes: ===================================== compiler/GHC/Tc/Instance/Family.hs ===================================== @@ -478,7 +478,8 @@ tcUnwrapNewtype_maybe :: FamInstEnvs -> Maybe (GlobalRdrElt, TcCoercion, Type) tcUnwrapNewtype_maybe faminsts rdr_env ty | Just (tc,tys) <- tcSplitTyConApp_maybe ty - = try_fam_unwrap tc tys + = firstJust (try_nt_unwrap tc tys) + (try_fam_unwrap tc tys) | otherwise = Nothing where @@ -490,7 +491,7 @@ tcUnwrapNewtype_maybe faminsts rdr_env ty , Just (gre, nt_co, ty') <- try_nt_unwrap tc' tys' = Just (gre, mkTransCo fam_co nt_co, ty') | otherwise - = try_nt_unwrap tc tys + = Nothing try_nt_unwrap tc tys | Just con <- newTyConDataCon_maybe tc ===================================== compiler/GHC/Tc/Solver/Equality.hs ===================================== @@ -356,13 +356,13 @@ can_eq_nc _rewritten _rdr_env _envs ev eq_rel ty1 _ ty2 _ -- See Note [Eager newtype decomposition] -- You might think that representational role would also be OK, but -- see Note [Even more eager newtype decomposition] - ok (ty1:tys1) (ty2:tys2) (r:rs) - | Phantom <- r = ok tys1 tys2 rs - | ty1 `tcEqType` ty2 = ok tys1 tys2 rs + ok (ty1:tys1) (ty2:tys2) rs + | Phantom : rs <- r = ok tys1 tys2 rs + | ty1 `tcEqType` ty2 = ok tys1 tys2 (drop 1 rs) | otherwise = False ok [] [] _ = True - ok _ _ [] = False -- Oversaturated TyCon - ok _ _ _ = pprPanic "can_eq_nc:mismatch" (ppr ty1 $$ ppr ty2) + ok _ _ _ = False -- Mis-matched lengths, just about possible because of + -- kind polymorphism. Anyway False is a safe result! -- Unwrap newtypes, when in ReprEq only -- See Note [Solving newtype equalities: overview] @@ -1223,7 +1223,7 @@ There are three ways in which decomposing [W] (N ty1) ~r (N ty2) could be incomp instance (a~Bool) => C [a] [W] g3 :: C [alpha] When we get around to solving `g3` we'll discover (g2:alpha~Bool) - So that's a real infelity in the solver. + So that's a real infelicity in the solver. * Incompleteness example (EX4): check available Givens newtype Nt a = Mk Bool -- NB: a is not used in the RHS, View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/aed328751ad7389de62660d30d1573ce... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/aed328751ad7389de62660d30d1573ce... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Simon Peyton Jones (@simonpj)