From 9b38f6a12c0a9e932ed4be4758d90556f868f6bf Mon Sep 17 00:00:00 2001 From: Richard Eisenberg Date: Fri, 21 Mar 2014 17:22:10 -0400 Subject: Comments only -- clarifying Notes around compatibility. --- compiler/iface/MkIface.lhs | 2 +- compiler/types/CoAxiom.lhs | 1 + compiler/types/FamInstEnv.lhs | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/iface/MkIface.lhs b/compiler/iface/MkIface.lhs index 51df08c44c..bb51cdae9d 100644 --- a/compiler/iface/MkIface.lhs +++ b/compiler/iface/MkIface.lhs @@ -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 -- to incompatible indices --- See [Storing compatibility] in CoAxiom +-- See Note [Storing compatibility] in CoAxiom coAxBranchToIfaceBranch :: TidyEnv -> [[Type]] -> CoAxBranch -> IfaceAxBranch coAxBranchToIfaceBranch env0 lhs_s branch@(CoAxBranch { cab_incomps = incomps }) diff --git a/compiler/types/CoAxiom.lhs b/compiler/types/CoAxiom.lhs index a0a4974831..d6122b21e6 100644 --- a/compiler/types/CoAxiom.lhs +++ b/compiler/types/CoAxiom.lhs @@ -327,6 +327,7 @@ isImplicitCoAxiom = co_ax_implicit coAxBranchIncomps :: CoAxBranch -> [CoAxBranch] coAxBranchIncomps = cab_incomps +-- See Note [Compatibility checking] in FamInstEnv placeHolderIncomps :: [CoAxBranch] placeHolderIncomps = panic "placeHolderIncomps" diff --git a/compiler/types/FamInstEnv.lhs b/compiler/types/FamInstEnv.lhs index c17668bbb5..0421f48a58 100644 --- a/compiler/types/FamInstEnv.lhs +++ b/compiler/types/FamInstEnv.lhs @@ -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 go back to all previous equations and check that, under the 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 no unifiers. The exact algorithm is different here because the the potentially-overlapping group is closed. @@ -475,6 +475,7 @@ irrelevant (clause 1 of compatible) or benign (clause 2 of compatible). \begin{code} +-- See Note [Compatibility] compatibleBranches :: CoAxBranch -> CoAxBranch -> Bool compatibleBranches (CoAxBranch { cab_lhs = lhs1, cab_rhs = rhs1 }) (CoAxBranch { cab_lhs = lhs2, cab_rhs = rhs2 }) @@ -487,6 +488,7 @@ compatibleBranches (CoAxBranch { cab_lhs = lhs1, cab_rhs = rhs1 }) -- takes a CoAxiom with unknown branch incompatibilities and computes -- the compatibilities +-- See Note [Storing compatibility] in CoAxiom computeAxiomIncomps :: CoAxiom br -> CoAxiom br computeAxiomIncomps ax@(CoAxiom { co_ax_branches = branches }) = ax { co_ax_branches = go [] branches } -- cgit v1.2.1