Commit 9b38f6a1 authored by eir@cis.upenn.edu's avatar eir@cis.upenn.edu
Browse files

Comments only -- clarifying Notes around compatibility.

parent be2e0e88
...@@ -1525,7 +1525,7 @@ coAxiomToIfaceDecl ax@(CoAxiom { co_ax_tc = tycon, co_ax_branches = branches ...@@ -1525,7 +1525,7 @@ coAxiomToIfaceDecl ax@(CoAxiom { co_ax_tc = tycon, co_ax_branches = branches
-- 2nd parameter is the list of branch LHSs, for conversion from incompatible branches -- 2nd parameter is the list of branch LHSs, for conversion from incompatible branches
-- to incompatible indices -- to incompatible indices
-- See [Storing compatibility] in CoAxiom -- See Note [Storing compatibility] in CoAxiom
coAxBranchToIfaceBranch :: TidyEnv -> [[Type]] -> CoAxBranch -> IfaceAxBranch coAxBranchToIfaceBranch :: TidyEnv -> [[Type]] -> CoAxBranch -> IfaceAxBranch
coAxBranchToIfaceBranch env0 lhs_s coAxBranchToIfaceBranch env0 lhs_s
branch@(CoAxBranch { cab_incomps = incomps }) branch@(CoAxBranch { cab_incomps = incomps })
......
...@@ -327,6 +327,7 @@ isImplicitCoAxiom = co_ax_implicit ...@@ -327,6 +327,7 @@ isImplicitCoAxiom = co_ax_implicit
coAxBranchIncomps :: CoAxBranch -> [CoAxBranch] coAxBranchIncomps :: CoAxBranch -> [CoAxBranch]
coAxBranchIncomps = cab_incomps coAxBranchIncomps = cab_incomps
-- See Note [Compatibility checking] in FamInstEnv
placeHolderIncomps :: [CoAxBranch] placeHolderIncomps :: [CoAxBranch]
placeHolderIncomps = panic "placeHolderIncomps" placeHolderIncomps = panic "placeHolderIncomps"
......
...@@ -439,7 +439,7 @@ only when we can be sure that 'a' is not Int. ...@@ -439,7 +439,7 @@ only when we can be sure that 'a' is not Int.
To achieve this, after finding a possible match within the equations, we have to To achieve this, after finding a possible match within the equations, we have to
go back to all previous equations and check that, under the go back to all previous equations and check that, under the
substitution induced by the match, other branches are surely apart. (See substitution induced by the match, other branches are surely apart. (See
[Apartness].) This is similar to what happens with class Note [Apartness].) This is similar to what happens with class
instance selection, when we need to guarantee that there is only a match and instance selection, when we need to guarantee that there is only a match and
no unifiers. The exact algorithm is different here because the the no unifiers. The exact algorithm is different here because the the
potentially-overlapping group is closed. potentially-overlapping group is closed.
...@@ -475,6 +475,7 @@ irrelevant (clause 1 of compatible) or benign (clause 2 of compatible). ...@@ -475,6 +475,7 @@ irrelevant (clause 1 of compatible) or benign (clause 2 of compatible).
\begin{code} \begin{code}
-- See Note [Compatibility]
compatibleBranches :: CoAxBranch -> CoAxBranch -> Bool compatibleBranches :: CoAxBranch -> CoAxBranch -> Bool
compatibleBranches (CoAxBranch { cab_lhs = lhs1, cab_rhs = rhs1 }) compatibleBranches (CoAxBranch { cab_lhs = lhs1, cab_rhs = rhs1 })
(CoAxBranch { cab_lhs = lhs2, cab_rhs = rhs2 }) (CoAxBranch { cab_lhs = lhs2, cab_rhs = rhs2 })
...@@ -487,6 +488,7 @@ compatibleBranches (CoAxBranch { cab_lhs = lhs1, cab_rhs = rhs1 }) ...@@ -487,6 +488,7 @@ compatibleBranches (CoAxBranch { cab_lhs = lhs1, cab_rhs = rhs1 })
-- takes a CoAxiom with unknown branch incompatibilities and computes -- takes a CoAxiom with unknown branch incompatibilities and computes
-- the compatibilities -- the compatibilities
-- See Note [Storing compatibility] in CoAxiom
computeAxiomIncomps :: CoAxiom br -> CoAxiom br computeAxiomIncomps :: CoAxiom br -> CoAxiom br
computeAxiomIncomps ax@(CoAxiom { co_ax_branches = branches }) computeAxiomIncomps ax@(CoAxiom { co_ax_branches = branches })
= ax { co_ax_branches = go [] branches } = ax { co_ax_branches = go [] branches }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment