[commit: ghc] master: Improve error message for fundeps a bit more (b8a4085)

git at git.haskell.org git
Tue Oct 1 18:21:25 UTC 2013


Repository : ssh://git at git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/b8a40855c2bde5a04f548b77c163e05900e01834/ghc

>---------------------------------------------------------------

commit b8a40855c2bde5a04f548b77c163e05900e01834
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Tue Oct 1 19:20:21 2013 +0100

    Improve error message for fundeps a bit more


>---------------------------------------------------------------

b8a40855c2bde5a04f548b77c163e05900e01834
 compiler/types/FunDeps.lhs |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/compiler/types/FunDeps.lhs b/compiler/types/FunDeps.lhs
index 5b24081..2d4fa39 100644
--- a/compiler/types/FunDeps.lhs
+++ b/compiler/types/FunDeps.lhs
@@ -475,14 +475,18 @@ checkInstCoverage be_liberal clas theta inst_taus
          conservative_ok = rs_tvs `subVarSet` ls_tvs
          liberal_ok      = rs_tvs `subVarSet` oclose theta ls_tvs
 
-         liberal_doc = ppWhen be_liberal (ptext (sLit "liberal"))
-         msg = vcat [ sep [ ptext (sLit "The") <+> liberal_doc
+         msg = vcat [ sep [ ptext (sLit "The")
+                            <+> ppWhen be_liberal (ptext (sLit "liberal"))
                             <+> ptext (sLit "coverage condition fails in class")
                             <+> quotes (ppr clas)
                           , nest 2 $ ptext (sLit "for functional dependency:")
                             <+> quotes (pprFunDep fd) ]
-                    , sep [ ptext (sLit "Reason:") <+> pprQuotedList ls
-                          , nest 2 $ ptext (sLit "do not jointly determine")
+                    , sep [ ptext (sLit "Reason: lhs type")<>plural ls <+> pprQuotedList ls
+                          , nest 2 $
+                            (if isSingleton ls
+                             then ptext (sLit "does not")
+                             else ptext (sLit "do not jointly"))
+                            <+> ptext (sLit "deternine rhs type")<>plural rs
                             <+> pprQuotedList rs ]
                     , ppWhen (not be_liberal && liberal_ok) $
                       ptext (sLit "Using UndecidableInstances might help") ]




More information about the ghc-commits mailing list