X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcRnTypes.lhs;h=9a08e9a6535d65661922adc6ecf5a5e1523ccd82;hb=382fce427106197b5e7dec81165af20329ac6cc2;hp=42f4ff43a67532515ccdfb43087ab5241788c16f;hpb=a3a15a646977ab98f9150bb2b926d960796077e4;p=ghc-hetmet.git diff --git a/compiler/typecheck/TcRnTypes.lhs b/compiler/typecheck/TcRnTypes.lhs index 42f4ff4..9a08e9a 100644 --- a/compiler/typecheck/TcRnTypes.lhs +++ b/compiler/typecheck/TcRnTypes.lhs @@ -598,15 +598,20 @@ data Inst | ImplicInst { -- An implication constraint -- forall tvs. (reft, given) => wanted tci_name :: Name, - tci_tyvars :: [TcTyVar], -- Includes coercion variables + tci_tyvars :: [TcTyVar], -- Quantified type variables + -- Includes coercion variables -- mentioned in tci_reft tci_reft :: Refinement, tci_given :: [Inst], -- Only Dicts -- (no Methods, LitInsts, ImplicInsts) tci_wanted :: [Inst], -- Only Dicts and ImplicInsts -- (no Methods or LitInsts) + tci_loc :: InstLoc } + -- NB: the tci_given are not necessarily rigid, + -- although they will be if the tci_reft is non-trivial + -- NB: the tci_reft is already applied to tci_given and tci_wanted | Method { tci_id :: TcId, -- The Id for the Inst @@ -702,10 +707,20 @@ emptyLIE = emptyBag unitLIE inst = unitBag inst mkLIE insts = listToBag insts plusLIE lie1 lie2 = lie1 `unionBags` lie2 -consLIE inst lie = inst `consBag` lie plusLIEs lies = unionManyBags lies lieToList = bagToList listToLIE = listToBag + +consLIE inst lie = lie `snocBag` inst +-- Putting the new Inst at the *end* of the bag is a half-hearted attempt +-- to ensure that we tend to report the *leftmost* type-constraint error +-- E.g. f :: [a] +-- f = [1,2,3] +-- we'd like to complain about the '1', not the '3'. +-- +-- "Half-hearted" because the rest of the type checker makes no great +-- claims for retaining order in the constraint set. Still, this +-- seems to improve matters slightly. Exampes: mdofail001, tcfail015 \end{code}