| ... |
... |
@@ -9,6 +9,7 @@ module GHC.Core.Unify ( |
|
9
|
9
|
tcMatchTyX_BM, ruleMatchTyKiX,
|
|
10
|
10
|
|
|
11
|
11
|
-- Side-effect free unification
|
|
|
12
|
+ AmIUnifying(..),
|
|
12
|
13
|
tcUnifyTy, tcUnifyTys, tcUnifyFunDeps, tcUnifyDebugger,
|
|
13
|
14
|
tcUnifyTysFG, tcUnifyTysForInjectivity,
|
|
14
|
15
|
BindTvFun, BindFamFun, BindFlag(..),
|
| ... |
... |
@@ -597,14 +598,14 @@ tcMatchTyX_BM :: HasDebugCallStack |
|
597
|
598
|
=> BindTvFun -> Subst
|
|
598
|
599
|
-> Type -> Type -> Maybe Subst
|
|
599
|
600
|
tcMatchTyX_BM bind_tv subst ty1 ty2
|
|
600
|
|
- = tc_match_tys_x bind_tv False subst [ty1] [ty2]
|
|
|
601
|
+ = tc_match_tys_x bind_tv IgnoreOuterKinds subst [ty1] [ty2]
|
|
601
|
602
|
|
|
602
|
603
|
-- | Like 'tcMatchTy', but allows the kinds of the types to differ,
|
|
603
|
604
|
-- and thus matches them as well.
|
|
604
|
605
|
-- See also Note [tcMatchTy vs tcMatchTyKi]
|
|
605
|
606
|
tcMatchTyKi :: HasDebugCallStack => Type -> Type -> Maybe Subst
|
|
606
|
607
|
tcMatchTyKi ty1 ty2
|
|
607
|
|
- = tc_match_tys alwaysBindTv True [ty1] [ty2]
|
|
|
608
|
+ = tc_match_tys alwaysBindTv CheckOuterKinds [ty1] [ty2]
|
|
608
|
609
|
|
|
609
|
610
|
-- | This is similar to 'tcMatchTy', but extends a substitution
|
|
610
|
611
|
-- See also Note [tcMatchTy vs tcMatchTyKi]
|
| ... |
... |
@@ -614,7 +615,7 @@ tcMatchTyX :: HasDebugCallStack |
|
614
|
615
|
-> Type -- ^ Target
|
|
615
|
616
|
-> Maybe Subst
|
|
616
|
617
|
tcMatchTyX subst ty1 ty2
|
|
617
|
|
- = tc_match_tys_x alwaysBindTv False subst [ty1] [ty2]
|
|
|
618
|
+ = tc_match_tys_x alwaysBindTv IgnoreOuterKinds subst [ty1] [ty2]
|
|
618
|
619
|
|
|
619
|
620
|
-- | Like 'tcMatchTy' but over a list of types.
|
|
620
|
621
|
-- See also Note [tcMatchTy vs tcMatchTyKi]
|
| ... |
... |
@@ -625,7 +626,7 @@ tcMatchTys :: HasDebugCallStack |
|
625
|
626
|
-- variables could be free in the target
|
|
626
|
627
|
-- See (CU6) in Note [The Core unifier]
|
|
627
|
628
|
tcMatchTys tys1 tys2
|
|
628
|
|
- = tc_match_tys alwaysBindTv False tys1 tys2
|
|
|
629
|
+ = tc_match_tys alwaysBindTv IgnoreOuterKinds tys1 tys2
|
|
629
|
630
|
|
|
630
|
631
|
-- | Like 'tcMatchTyKi' but over a list of types.
|
|
631
|
632
|
-- See also Note [tcMatchTy vs tcMatchTyKi]
|
| ... |
... |
@@ -635,7 +636,7 @@ tcMatchTyKis :: HasDebugCallStack |
|
635
|
636
|
-> Maybe Subst -- ^ One-shot substitution
|
|
636
|
637
|
-- See (CU6) in Note [The Core unifier]
|
|
637
|
638
|
tcMatchTyKis tys1 tys2
|
|
638
|
|
- = tc_match_tys alwaysBindTv True tys1 tys2
|
|
|
639
|
+ = tc_match_tys alwaysBindTv CheckOuterKinds tys1 tys2
|
|
639
|
640
|
|
|
640
|
641
|
-- | Like 'tcMatchTys', but extending a substitution
|
|
641
|
642
|
-- See also Note [tcMatchTy vs tcMatchTyKi]
|
| ... |
... |
@@ -645,7 +646,7 @@ tcMatchTysX :: HasDebugCallStack |
|
645
|
646
|
-> [Type] -- ^ Target
|
|
646
|
647
|
-> Maybe Subst -- ^ One-shot substitution
|
|
647
|
648
|
tcMatchTysX subst tys1 tys2
|
|
648
|
|
- = tc_match_tys_x alwaysBindTv False subst tys1 tys2
|
|
|
649
|
+ = tc_match_tys_x alwaysBindTv IgnoreOuterKinds subst tys1 tys2
|
|
649
|
650
|
|
|
650
|
651
|
-- | Like 'tcMatchTyKis', but extending a substitution
|
|
651
|
652
|
-- See also Note [tcMatchTy vs tcMatchTyKi]
|
| ... |
... |
@@ -655,12 +656,12 @@ tcMatchTyKisX :: HasDebugCallStack |
|
655
|
656
|
-> [Type] -- ^ Target
|
|
656
|
657
|
-> Maybe Subst -- ^ One-shot substitution
|
|
657
|
658
|
tcMatchTyKisX subst tys1 tys2
|
|
658
|
|
- = tc_match_tys_x alwaysBindTv True subst tys1 tys2
|
|
|
659
|
+ = tc_match_tys_x alwaysBindTv CheckOuterKinds subst tys1 tys2
|
|
659
|
660
|
|
|
660
|
661
|
-- | Same as tc_match_tys_x, but starts with an empty substitution
|
|
661
|
662
|
tc_match_tys :: HasDebugCallStack
|
|
662
|
663
|
=> BindTvFun
|
|
663
|
|
- -> Bool -- ^ match kinds?
|
|
|
664
|
+ -> OuterKindsFlag -- ^ Match kinds?
|
|
664
|
665
|
-> [Type]
|
|
665
|
666
|
-> [Type]
|
|
666
|
667
|
-> Maybe Subst
|
| ... |
... |
@@ -672,7 +673,7 @@ tc_match_tys bind_me match_kis tys1 tys2 |
|
672
|
673
|
-- | Worker for 'tcMatchTysX' and 'tcMatchTyKisX'
|
|
673
|
674
|
tc_match_tys_x :: HasDebugCallStack
|
|
674
|
675
|
=> BindTvFun
|
|
675
|
|
- -> Bool -- ^ match kinds?
|
|
|
676
|
+ -> OuterKindsFlag -- ^ Match kinds?
|
|
676
|
677
|
-> Subst
|
|
677
|
678
|
-> [Type]
|
|
678
|
679
|
-> [Type]
|
| ... |
... |
@@ -680,8 +681,8 @@ tc_match_tys_x :: HasDebugCallStack |
|
680
|
681
|
tc_match_tys_x bind_tv match_kis (Subst in_scope id_env tv_env cv_env) tys1 tys2
|
|
681
|
682
|
= case tc_unify_tys neverBindFam -- (ATF7) in Note [Apartness and type families]
|
|
682
|
683
|
bind_tv
|
|
683
|
|
- False -- Matching, not unifying
|
|
684
|
|
- False -- Not an injectivity check
|
|
|
684
|
+ Matching -- Matching, not unifying
|
|
|
685
|
+ False -- Not an injectivity check
|
|
685
|
686
|
match_kis
|
|
686
|
687
|
RespectMultiplicities
|
|
687
|
688
|
(mkRnEnv2 in_scope) tv_env cv_env tys1 tys2 of
|
| ... |
... |
@@ -706,9 +707,9 @@ ruleMatchTyKiX tmpl_tvs rn_env tenv tmpl target |
|
706
|
707
|
-- But even if it did, (ATF8) in Note [Apartness and type families]
|
|
707
|
708
|
-- says it doesn't matter becuase here we only care about Unifiable.
|
|
708
|
709
|
-- So neverBindFam is efficient, and sufficient.
|
|
709
|
|
- False -- Matching, not unifying
|
|
|
710
|
+ Matching -- Matching, not unifying
|
|
710
|
711
|
False -- No doing an injectivity check
|
|
711
|
|
- True -- Match the kinds
|
|
|
712
|
+ CheckOuterKinds -- Match the kinds
|
|
712
|
713
|
IgnoreMultiplicities
|
|
713
|
714
|
-- See Note [Rewrite rules ignore multiplicities in FunTy]
|
|
714
|
715
|
rn_env tenv emptyCvSubstEnv [tmpl] [target] of
|
| ... |
... |
@@ -784,7 +785,7 @@ tcUnifyTy t1 t2 = tcUnifyTys alwaysBindTv [t1] [t2] |
|
784
|
785
|
tcUnifyDebugger :: Type -> Type -> Maybe Subst
|
|
785
|
786
|
tcUnifyDebugger t1 t2
|
|
786
|
787
|
= case tc_unify_tys_fg
|
|
787
|
|
- True -- Unify kinds
|
|
|
788
|
+ CheckOuterKinds -- Unify kinds
|
|
788
|
789
|
neverBindFam -- Does not affect Unifiable, so pick max efficient
|
|
789
|
790
|
-- See (ATF8) in Note [Apartness and type families]
|
|
790
|
791
|
alwaysBindTv
|
| ... |
... |
@@ -798,7 +799,7 @@ tcUnifyFunDeps :: TyCoVarSet |
|
798
|
799
|
-> Maybe Subst
|
|
799
|
800
|
tcUnifyFunDeps qtvs tys1 tys2
|
|
800
|
801
|
= case tc_unify_tys_fg
|
|
801
|
|
- True -- Unify kinds
|
|
|
802
|
+ CheckOuterKinds -- Unify kinds
|
|
802
|
803
|
dontCareBindFam -- Class-instance heads never mention type families
|
|
803
|
804
|
(matchBindTv qtvs)
|
|
804
|
805
|
tys1 tys2 of
|
| ... |
... |
@@ -821,7 +822,7 @@ tcUnifyTysForInjectivity unif tys1 tys2 |
|
821
|
822
|
= case tc_unify_tys alwaysBindFam alwaysBindTv
|
|
822
|
823
|
unif -- Am I unifying?
|
|
823
|
824
|
True -- Do injectivity checks
|
|
824
|
|
- False -- Don't check outermost kinds
|
|
|
825
|
+ IgnoreOuterKinds -- Don't check outermost kinds
|
|
825
|
826
|
RespectMultiplicities
|
|
826
|
827
|
rn_env emptyTvSubstEnv emptyCvSubstEnv
|
|
827
|
828
|
tys1 tys2 of
|
| ... |
... |
@@ -838,8 +839,9 @@ tcUnifyTysForInjectivity unif tys1 tys2 |
|
838
|
839
|
-- should never actually be done
|
|
839
|
840
|
|
|
840
|
841
|
maybe_fix tv_subst
|
|
841
|
|
- | unif = niFixSubst in_scope tv_subst
|
|
842
|
|
- | otherwise = mkTvSubst in_scope tv_subst
|
|
|
842
|
+ = case unif of
|
|
|
843
|
+ Unifying -> niFixSubst in_scope tv_subst
|
|
|
844
|
+ Matching -> mkTvSubst in_scope tv_subst
|
|
843
|
845
|
-- When matching, don't confuse domain with range; no fixpoint!
|
|
844
|
846
|
|
|
845
|
847
|
-----------------
|
| ... |
... |
@@ -866,15 +868,15 @@ tcUnifyTysFG :: BindFamFun -> BindTvFun |
|
866
|
868
|
-> [Type] -> [Type]
|
|
867
|
869
|
-> UnifyResult
|
|
868
|
870
|
tcUnifyTysFG bind_fam bind_tv tys1 tys2
|
|
869
|
|
- = tc_unify_tys_fg False bind_fam bind_tv tys1 tys2
|
|
|
871
|
+ = tc_unify_tys_fg IgnoreOuterKinds bind_fam bind_tv tys1 tys2
|
|
870
|
872
|
|
|
871
|
|
-tc_unify_tys_fg :: Bool
|
|
|
873
|
+tc_unify_tys_fg :: OuterKindsFlag
|
|
872
|
874
|
-> BindFamFun -> BindTvFun
|
|
873
|
875
|
-> [Type] -> [Type]
|
|
874
|
876
|
-> UnifyResult
|
|
875
|
877
|
tc_unify_tys_fg match_kis bind_fam bind_tv tys1 tys2
|
|
876
|
878
|
= do { (tv_env, _) <- tc_unify_tys bind_fam bind_tv
|
|
877
|
|
- True -- Unifying
|
|
|
879
|
+ Unifying
|
|
878
|
880
|
False -- Not doing an injectivity check
|
|
879
|
881
|
match_kis -- Match outer kinds
|
|
880
|
882
|
RespectMultiplicities rn_env
|
| ... |
... |
@@ -888,10 +890,10 @@ tc_unify_tys_fg match_kis bind_fam bind_tv tys1 tys2 |
|
888
|
890
|
-- | This function is actually the one to call the unifier -- a little
|
|
889
|
891
|
-- too general for outside clients, though.
|
|
890
|
892
|
tc_unify_tys :: BindFamFun -> BindTvFun
|
|
891
|
|
- -> AmIUnifying -- ^ True <=> unify; False <=> match
|
|
892
|
|
- -> Bool -- ^ True <=> doing an injectivity check
|
|
893
|
|
- -> Bool -- ^ True <=> treat the kinds as well
|
|
894
|
|
- -> MultiplicityFlag -- ^ see Note [Rewrite rules ignore multiplicities in FunTy] in GHC.Core.Unify
|
|
|
893
|
+ -> AmIUnifying -- ^ Unifying or matching
|
|
|
894
|
+ -> Bool -- ^ True <=> doing an injectivity check
|
|
|
895
|
+ -> OuterKindsFlag -- ^ Check outer kinds or not
|
|
|
896
|
+ -> MultiplicityFlag -- ^ see Note [Rewrite rules ignore multiplicities in FunTy] in GHC.Core.Unify
|
|
895
|
897
|
-> RnEnv2
|
|
896
|
898
|
-> TvSubstEnv -- ^ substitution to extend
|
|
897
|
899
|
-> CvSubstEnv
|
| ... |
... |
@@ -910,8 +912,9 @@ tc_unify_tys :: BindFamFun -> BindTvFun |
|
910
|
912
|
-- See also Note [tcMatchTy vs tcMatchTyKi].
|
|
911
|
913
|
tc_unify_tys bind_fam bind_tv unif inj_check match_kis match_mults rn_env tv_env cv_env tys1 tys2
|
|
912
|
914
|
= initUM tv_env cv_env $
|
|
913
|
|
- do { when match_kis $
|
|
914
|
|
- unify_tys env kis1 kis2
|
|
|
915
|
+ do { case match_kis of
|
|
|
916
|
+ CheckOuterKinds -> unify_tys env kis1 kis2
|
|
|
917
|
+ IgnoreOuterKinds -> return ()
|
|
915
|
918
|
; unify_tys env tys1 tys2 }
|
|
916
|
919
|
where
|
|
917
|
920
|
env = UMEnv { um_bind_tv_fun = bind_tv
|
| ... |
... |
@@ -926,6 +929,11 @@ tc_unify_tys bind_fam bind_tv unif inj_check match_kis match_mults rn_env tv_env |
|
926
|
929
|
kis2 = map typeKind tys2
|
|
927
|
930
|
|
|
928
|
931
|
|
|
|
932
|
+data OuterKindsFlag
|
|
|
933
|
+ = CheckOuterKinds -- Unify or match the /kind/ of the two types
|
|
|
934
|
+ | IgnoreOuterKinds -- Just unify of match the types, ignoring kinds
|
|
|
935
|
+ -- (typically, we already know they are equal)
|
|
|
936
|
+
|
|
929
|
937
|
{- *********************************************************************
|
|
930
|
938
|
* *
|
|
931
|
939
|
UnifyResult, MaybeApart etc
|
| ... |
... |
@@ -1583,8 +1591,7 @@ c.f. Note [Comparing type synonyms] in GHC.Core.TyCo.Compare |
|
1583
|
1591
|
|
|
1584
|
1592
|
-------------- unify_ty: the main workhorse -----------
|
|
1585
|
1593
|
|
|
1586
|
|
-type AmIUnifying = Bool -- True <=> Unifying
|
|
1587
|
|
- -- False <=> Matching
|
|
|
1594
|
+data AmIUnifying = Matching | Unifying
|
|
1588
|
1595
|
|
|
1589
|
1596
|
type InType = Type -- Before applying the RnEnv2
|
|
1590
|
1597
|
type OutCoercion = Coercion -- After applying the RnEnv2
|
| ... |
... |
@@ -1618,7 +1625,7 @@ unify_ty env (CastTy ty1 co1) ty2 kco |
|
1618
|
1625
|
-- See (KCU1) in Note [Kind coercions in Unify]
|
|
1619
|
1626
|
= maybeApart MARCast -- See (KCU2)
|
|
1620
|
1627
|
|
|
1621
|
|
- | um_unif env
|
|
|
1628
|
+ | Unifying <- um_unif env
|
|
1622
|
1629
|
= unify_ty env ty1 ty2 (co1 `mkTransCo` kco)
|
|
1623
|
1630
|
|
|
1624
|
1631
|
| otherwise -- We are matching, not unifying
|
| ... |
... |
@@ -1661,7 +1668,7 @@ unify_ty env (CoercionTy co1) (CoercionTy co2) kco |
|
1661
|
1668
|
= do { c_subst <- getCvSubstEnv
|
|
1662
|
1669
|
; case co1 of
|
|
1663
|
1670
|
CoVarCo cv
|
|
1664
|
|
- | not (um_unif env)
|
|
|
1671
|
+ | Matching <- um_unif env
|
|
1665
|
1672
|
, not (cv `elemVarEnv` c_subst) -- Not forall-bound
|
|
1666
|
1673
|
, let (_mult_co, co_l, co_r) = decomposeFunCo kco
|
|
1667
|
1674
|
-- Because the coercion is used in a type, it should be safe to
|
| ... |
... |
@@ -1682,7 +1689,7 @@ unify_ty env (TyVarTy tv1) ty2 kco |
|
1682
|
1689
|
= uVarOrFam env (TyVarLHS tv1) ty2 kco
|
|
1683
|
1690
|
|
|
1684
|
1691
|
unify_ty env ty1 (TyVarTy tv2) kco
|
|
1685
|
|
- | um_unif env -- If unifying, can swap args; but not when matching
|
|
|
1692
|
+ | Unifying <- um_unif env -- If unifying, can swap args; but not when matching
|
|
1686
|
1693
|
= uVarOrFam (umSwapRn env) (TyVarLHS tv2) ty1 (mkSymCo kco)
|
|
1687
|
1694
|
|
|
1688
|
1695
|
-- Deal with TyConApps
|
| ... |
... |
@@ -1692,7 +1699,7 @@ unify_ty env ty1 ty2 kco |
|
1692
|
1699
|
| Just (tc,tys) <- mb_sat_fam_app1
|
|
1693
|
1700
|
= uVarOrFam env (TyFamLHS tc tys) ty2 kco
|
|
1694
|
1701
|
|
|
1695
|
|
- | um_unif env
|
|
|
1702
|
+ | Unifying <- um_unif env
|
|
1696
|
1703
|
, Just (tc,tys) <- mb_sat_fam_app2
|
|
1697
|
1704
|
= uVarOrFam (umSwapRn env) (TyFamLHS tc tys) ty1 (mkSymCo kco)
|
|
1698
|
1705
|
|
| ... |
... |
@@ -1820,7 +1827,7 @@ uVarOrFam env ty1 ty2 kco |
|
1820
|
1827
|
go swapped substs lhs@(TyVarLHS tv1) ty2 kco
|
|
1821
|
1828
|
| Just ty1' <- lookupVarEnv (um_tv_env substs) tv1'
|
|
1822
|
1829
|
= -- We already have a substitution for tv1
|
|
1823
|
|
- if | um_unif env -> unify_ty env ty1' ty2 kco
|
|
|
1830
|
+ if | Unifying <- um_unif env -> unify_ty env ty1' ty2 kco
|
|
1824
|
1831
|
| (ty1' `mkCastTy` kco) `tcEqType` ty2 -> return ()
|
|
1825
|
1832
|
| otherwise -> surelyApart
|
|
1826
|
1833
|
-- Unifying: recurse into unify_ty
|
| ... |
... |
@@ -1842,9 +1849,9 @@ uVarOrFam env ty1 ty2 kco |
|
1842
|
1849
|
| TyVarTy tv2 <- ty2
|
|
1843
|
1850
|
, let tv2' = umRnOccR env tv2
|
|
1844
|
1851
|
, tv1' == tv2'
|
|
1845
|
|
- = if | um_unif env -> return ()
|
|
1846
|
|
- | tv1_is_bindable -> extendTvEnv tv1' ty2
|
|
1847
|
|
- | otherwise -> return ()
|
|
|
1852
|
+ = if | Unifying <- um_unif env -> return ()
|
|
|
1853
|
+ | tv1_is_bindable -> extendTvEnv tv1' ty2
|
|
|
1854
|
+ | otherwise -> return ()
|
|
1848
|
1855
|
|
|
1849
|
1856
|
| tv1_is_bindable
|
|
1850
|
1857
|
, not (mentionsForAllBoundTyVarsR env ty2_fvs)
|
| ... |
... |
@@ -1858,9 +1865,9 @@ uVarOrFam env ty1 ty2 kco |
|
1858
|
1865
|
-- e.g. a ~ F p q with `a` not bindable: we might succeed with go_fam
|
|
1859
|
1866
|
-- e.g. a ~ beta with `a` not bindable: we might be able to bind `beta`
|
|
1860
|
1867
|
-- e.g. beta ~ F beta Int occurs check; but MaybeApart after swapping
|
|
1861
|
|
- | um_unif env
|
|
|
1868
|
+ | Unifying <- um_unif env
|
|
1862
|
1869
|
, NotSwapped <- swapped -- If we have swapped already, don't do so again
|
|
1863
|
|
- , Just lhs2 <- canEqLHS_maybe ty2
|
|
|
1870
|
+ , Just lhs2 <- canEqLHS_maybe ty2
|
|
1864
|
1871
|
= go IsSwapped substs lhs2 (mkTyVarTy tv1) (mkSymCo kco)
|
|
1865
|
1872
|
|
|
1866
|
1873
|
| occurs_check = maybeApart MARInfinite -- Occurs check
|
| ... |
... |
@@ -1879,7 +1886,9 @@ uVarOrFam env ty1 ty2 kco |
|
1879
|
1886
|
| otherwise
|
|
1880
|
1887
|
= False
|
|
1881
|
1888
|
|
|
1882
|
|
- occurs_check = um_unif env && uOccursCheck substs foralld_tvs lhs rhs
|
|
|
1889
|
+ occurs_check = case um_unif env of
|
|
|
1890
|
+ Unifying -> uOccursCheck substs foralld_tvs lhs rhs
|
|
|
1891
|
+ Matching -> False
|
|
1883
|
1892
|
-- Occurs check, only when unifying
|
|
1884
|
1893
|
-- see Note [Infinitary substitutions]
|
|
1885
|
1894
|
-- Make sure you include `kco` in rhs #14846
|
| ... |
... |
@@ -1893,7 +1902,7 @@ uVarOrFam env ty1 ty2 kco |
|
1893
|
1902
|
-- Hence the RnEnv2 is empty
|
|
1894
|
1903
|
| not under_forall
|
|
1895
|
1904
|
, Just ty1' <- lookupFamEnv (um_fam_env substs) tc1 tys1
|
|
1896
|
|
- = if | um_unif env -> unify_ty env ty1' ty2 kco
|
|
|
1905
|
+ = if | Unifying <- um_unif env -> unify_ty env ty1' ty2 kco
|
|
1897
|
1906
|
-- Below here we are matching
|
|
1898
|
1907
|
-- The return () case deals with:
|
|
1899
|
1908
|
-- Template: (F a)..(F a)
|
| ... |
... |
@@ -1930,9 +1939,9 @@ uVarOrFam env ty1 ty2 kco |
|
1930
|
1939
|
-- NB: a type family can appear on the template when matching
|
|
1931
|
1940
|
-- see (ATF6) in Note [Apartness and type families]
|
|
1932
|
1941
|
-- (Only worth doing this if we are not under a forall.)
|
|
1933
|
|
- | um_unif env
|
|
|
1942
|
+ | Unifying <- um_unif env
|
|
1934
|
1943
|
, NotSwapped <- swapped
|
|
1935
|
|
- , Just lhs2 <- canEqLHS_maybe ty2
|
|
|
1944
|
+ , Just lhs2 <- canEqLHS_maybe ty2
|
|
1936
|
1945
|
= go IsSwapped substs lhs2 (mkTyConApp tc1 tys1) (mkSymCo kco)
|
|
1937
|
1946
|
|
|
1938
|
1947
|
| otherwise -- See (ATF5) in Note [Apartness and type families]
|
| ... |
... |
@@ -1962,9 +1971,9 @@ uVarOrFam env ty1 ty2 kco |
|
1962
|
1971
|
(inj_tys2, noninj_tys2) = partitionByList inj tys2
|
|
1963
|
1972
|
|
|
1964
|
1973
|
bind_fam_if_poss
|
|
1965
|
|
- | not (um_unif env) -- Not when matching (ATF11-1)
|
|
|
1974
|
+ | Matching <- um_unif env -- Not when matching (ATF11-1)
|
|
1966
|
1975
|
= return ()
|
|
1967
|
|
- | under_forall -- Not under a forall (ATF3)
|
|
|
1976
|
+ | under_forall -- Not under a forall (ATF3)
|
|
1968
|
1977
|
= return ()
|
|
1969
|
1978
|
| BindMe <- um_bind_fam_fun env tc tys1 rhs1
|
|
1970
|
1979
|
= unless (uOccursCheck substs emptyVarSet (TyFamLHS tc tys1) rhs1) $
|