[commit: ghc] master: Do not do type-class defaulting if there are insoluble constraints (b9fccbc)

Simon Peyton Jones <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/b9fccbc8bc377cde8e75bce8c78470e3c4fa4018

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

commit b9fccbc8bc377cde8e75bce8c78470e3c4fa4018
Author: Simon Peyton Jones <[email protected]>
Date:   Thu Oct 4 17:55:38 2012 +0100

    Do not do type-class defaulting if there are insoluble constraints
    
    Type-class defaulting won't help with those insolubles,
    and it does make arbitrary choices that obfuscate the
    error messages from the insolubles.

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

 compiler/typecheck/TcSimplify.lhs |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/compiler/typecheck/TcSimplify.lhs b/compiler/typecheck/TcSimplify.lhs
index c0ff59d..09a5b11 100644
--- a/compiler/typecheck/TcSimplify.lhs
+++ b/compiler/typecheck/TcSimplify.lhs
@@ -79,7 +79,9 @@ simplifyTop wanteds
            ; simpl_top_loop wc_first_go }
     
     simpl_top_loop wc
-      | isEmptyWC wc 
+      | isEmptyWC wc || insolubleWC wc
+             -- Don't do type-class defaulting if there are insolubles
+             -- Doing so is not going to solve the insolubles
       = return wc
       | otherwise
       = do { wc_residual <- nestTcS (solve_wanteds_and_drop wc)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.