Major refactoring of the type inference engine
[ghc-hetmet.git] / compiler / typecheck / TcSplice.lhs
index cb4043e..cc18707 100644 (file)
@@ -343,16 +343,17 @@ tcBracket brack res_ty
        ; lie_var <- getConstraintVar
        ; let brack_stage = Brack cur_stage pending_splices lie_var
 
-       ; (meta_ty, lie) <- setStage brack_stage $
-                           captureConstraints $
-                           tc_bracket cur_stage brack
-
-       ; simplifyBracket lie
-
-       -- Make the expected type have the right shape
-       ; _ <- unifyType meta_ty res_ty
-
-       -- Return the original expression, not the type-decorated one
+          -- We want to check that there aren't any constraints that
+          -- can't be satisfied (e.g. Show Foo, where Foo has no Show
+          -- instance), but we aren't otherwise interested in the
+          -- results. Nor do we care about ambiguous dictionaries etc.
+          -- We will type check this bracket again at its usage site.
+       ; _ <- newImplication BracketSkol [] [] $
+              setStage brack_stage $
+              do { meta_ty <- tc_bracket cur_stage brack
+                 ; unifyType meta_ty res_ty }
+
+        -- Return the original expression, not the type-decorated one
        ; pendings <- readMutVar pending_splices
        ; return (noLoc (HsBracketOut brack pendings)) }