Commit 51bebb7c authored by Joachim Breitner's avatar Joachim Breitner
Browse files

Refactor: Origin of inferred Thetas

When doing non-standalone deriving, annotate each individual
unsimplified constraint with its own CtOrigin. This is just the
refactoring, so the CtOrigin is still CtDeriv in each case.
parent 0fe399c9
This diff is collapsed.
......@@ -36,7 +36,7 @@ module TcMType (
newEvVar, newEvVars, newEq, newDict,
newWantedEvVar, newWantedEvVars,
newTcEvBinds, addTcEvBind,
newFlatWanteds,
newFlatWanted, newFlatWanteds,
--------------------------------
-- Instantiation
......@@ -163,17 +163,17 @@ predTypeOccName ty = case classifyPredType ty of
*********************************************************************************
\begin{code}
newFlatWanted :: CtOrigin -> PredType -> TcM Ct
newFlatWanted orig pty
= do loc <- getCtLoc orig
v <- newWantedEvVar pty
return $ mkNonCanonical $
CtWanted { ctev_evar = v
, ctev_pred = pty
, ctev_loc = loc }
newFlatWanteds :: CtOrigin -> ThetaType -> TcM [Ct]
newFlatWanteds orig theta
= do { loc <- getCtLoc orig
; mapM (inst_to_wanted loc) theta }
where
inst_to_wanted loc pty
= do { v <- newWantedEvVar pty
; return $ mkNonCanonical $
CtWanted { ctev_evar = v
, ctev_pred = pty
, ctev_loc = loc } }
newFlatWanteds orig = mapM (newFlatWanted orig)
\end{code}
%************************************************************************
......
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