From 45deb4d603c392ac8f404052e7c68ce12f05538b Mon Sep 17 00:00:00 2001 From: simonpj Date: Fri, 19 Mar 2004 13:25:24 +0000 Subject: [PATCH] [project @ 2004-03-19 13:25:24 by simonpj] Add comments --- ghc/compiler/typecheck/TcSimplify.lhs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ghc/compiler/typecheck/TcSimplify.lhs b/ghc/compiler/typecheck/TcSimplify.lhs index 91ca3b8..a3e9352 100644 --- a/ghc/compiler/typecheck/TcSimplify.lhs +++ b/ghc/compiler/typecheck/TcSimplify.lhs @@ -912,6 +912,22 @@ Plan C (brutal) Return the bindings from Step 1. +A note about Plan C (arising from "bug" reported by George Russel March 2004) +Consider this: + + instance (HasBinary ty IO) => HasCodedValue ty + + foo :: HasCodedValue a => String -> IO a + + doDecodeIO :: HasCodedValue a => () -> () -> IO a + doDecodeIO codedValue view + = let { act = foo "foo" } in act + +You might think this should work becuase the call to foo gives rise to a constraint +(HasCodedValue t), which can be satisfied by the type sig for doDecodeIO. But the +restricted binding act = ... calls tcSimplifyRestricted, and PlanC simplifies the +constraint using the (rather bogus) instance declaration, and now we are stuffed. +I claim this is not really a bug. \begin{code} tcSimplifyRestricted -- Used for restricted binding groups -- 1.7.10.4