Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Alex D
GHC
Commits
5f0c4f9a
Commit
5f0c4f9a
authored
Jul 27, 2006
by
simonpj@microsoft.com
Browse files
Improve error message for deriving
parent
9ebd6bae
Changes
1
Hide whitespace changes
Inline
Side-by-side
compiler/typecheck/TcDeriv.lhs
View file @
5f0c4f9a
...
...
@@ -729,9 +729,9 @@ solveDerivEqns overlap_flag orig_eqns
gen_soln (_, clas, tc,tyvars,deriv_rhs)
= setSrcSpan (srcLocSpan (getSrcLoc tc)) $
do { let inst_tys = [mkTyConApp tc (mkTyVarTys tyvars)]
; theta <- addErrCtxt (derivInstCtxt
[]
clas inst_tys) $
; theta <- addErrCtxt (derivInstCtxt
1
clas inst_tys) $
tcSimplifyDeriv tc tyvars deriv_rhs
; addErrCtxt (derivInstCtxt theta clas inst_tys) $
; addErrCtxt (derivInstCtxt
2
theta clas inst_tys) $
checkValidInstance tyvars theta clas inst_tys
; return (sortLe (<=) theta) } -- Canonicalise before returning the soluction
where
...
...
@@ -960,8 +960,12 @@ derivCtxt :: TyCon -> SDoc
derivCtxt tycon
= ptext SLIT("When deriving instances for") <+> quotes (ppr tycon)
derivInstCtxt theta clas inst_tys
= hang (ptext SLIT("In the derived instance"))
2 (ptext SLIT("instance") <+> sep [pprThetaArrow theta, pprClassPred clas inst_tys])
derivInstCtxt1 clas inst_tys
= ptext SLIT("When deriving the instance for") <+> quotes (pprClassPred clas inst_tys)
derivInstCtxt2 theta clas inst_tys
= vcat [ptext SLIT("In the derived instance declaration"),
nest 2 (ptext SLIT("instance") <+> sep [pprThetaArrow theta,
pprClassPred clas inst_tys])]
\end{code}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment