Simon Peyton Jones pushed to branch wip/T23162-part2 at Glasgow Haskell Compiler / GHC Commits: 9106adf3 by Simon Peyton Jones at 2025-11-19T10:20:53+00:00 Comments - - - - - 1 changed file: - compiler/GHC/Tc/Solver/FunDeps.hs Changes: ===================================== compiler/GHC/Tc/Solver/FunDeps.hs ===================================== @@ -549,7 +549,7 @@ mkTopClosedFamEqFDs ax work_args work_rhs = do { let branches = fromBranches (coAxiomBranches ax) ; traceTcS "mkTopClosed" (ppr branches $$ ppr work_args $$ ppr work_rhs) ; case getRelevantBranches ax work_args work_rhs of - [eqn] -> return [eqn] + [eqn] -> return [eqn] -- If there is just one relevant equation, use it _ -> return [] } | otherwise = return [] @@ -580,6 +580,7 @@ hasRelevantGiven eqs_for_me work_args (EqCt { eq_rhs = work_rhs }) = False getRelevantBranches :: CoAxiom Branched -> [TcType] -> Xi -> [FunDepEqns] +-- Return the FunDepEqns that arise from each relevant branch getRelevantBranches ax work_args work_rhs = go [] (fromBranches (coAxiomBranches ax)) where @@ -628,16 +629,6 @@ mkTopOpenFamEqFDs fam_tc inj_flags work_args work_rhs | otherwise = Nothing -trim_qtvs :: Subst -> [TcTyVar] -> (Subst,[TcTyVar]) --- Tricky stuff: see (TIF1) in --- Note [Type inference for type families with injectivity] -trim_qtvs subst [] = (subst, []) -trim_qtvs subst (tv:tvs) - | tv `elemSubst` subst = trim_qtvs subst tvs - | otherwise = let !(subst1, tv') = substTyVarBndr subst tv - !(subst', tvs') = trim_qtvs subst1 tvs - in (subst', tv':tvs') - mkLocalFamEqFDs :: [EqCt] -> TyCon -> [Bool] -> [TcType] -> Xi -> TcS [FunDepEqns] mkLocalFamEqFDs eqs_for_me fam_tc inj_flags work_args work_rhs = do { let -- eqns_from_inerts: see (INJFAM:Wanted/other) @@ -657,6 +648,16 @@ mkLocalFamEqFDs eqs_for_me fam_tc inj_flags work_args work_rhs mk_eqn iargs = mkInjectivityFDEqn inj_flags [] work_args iargs +trim_qtvs :: Subst -> [TcTyVar] -> (Subst,[TcTyVar]) +-- Tricky stuff: see (TIF1) in +-- Note [Type inference for type families with injectivity] +trim_qtvs subst [] = (subst, []) +trim_qtvs subst (tv:tvs) + | tv `elemSubst` subst = trim_qtvs subst tvs + | otherwise = let !(subst1, tv') = substTyVarBndr subst tv + !(subst', tvs') = trim_qtvs subst1 tvs + in (subst', tv':tvs') + ----------------------------------------- -- Built-in type families ----------------------------------------- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9106adf35ef38c62d2720b0ed761d353... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9106adf35ef38c62d2720b0ed761d353... You're receiving this email because of your account on gitlab.haskell.org.