RE: -fallow-incoherent-instances

It is strange that adding -fallow-incoherent-instances should *stop* it compiling. This does not happen in the HEAD. I can see why it happens in 6.2 You are on very very very thin ice with this program. You have instance Confuse a => Typeable a f :: Typeable a => ... f x = ....stuff that needs Typeable .... At any time the compiler might use the instance decl to reduce the constraint Typeable a to Confuse a The only thing *stopping* it doing so is the desire to preserve coherence, which is why it does though before you add the flag. When you add the flag -fallow-incoherent-instances, the compiler feels free to reduce Typeable a to Confuse a... but then it finds that the type signature for f only provides Typeable. Sorry.. but if you have all of undecidable instances overlapping instances incoherent instances then life is pretty wild. Simon | -----Original Message----- | From: glasgow-haskell-users-bounces@haskell.org [mailto:glasgow-haskell-users- | bounces@haskell.org] On Behalf Of Christian Maeder | Sent: 30 November 2004 11:48 | To: GHC Users Mailing List | Subject: -fallow-incoherent-instances | | The attached module does not compile and yields the following error: | | InCoherentInst.hs:17: | Could not deduce (Confuse a) from the context (Typeable a) | arising from use of `breakFn' at InCoherentInst.hs:17 | Probable fix: | Add (Confuse a) to the type signature(s) for `addGeneralFallOut' | In the first argument of `GeneralBreakFn', namely `breakFn' | In the definition of `addGeneralFallOut': | addGeneralFallOut = let | breakFn a = throwDyn (GeneralFallOutExcep a) | in GeneralBreakFn breakFn | | | The same source compiles ok without -fallow-incoherent-instances (or | with -fno-allow-incoherent-instances). | | If, furthermore, the "confusing instance" is commented out, the source | even compiles without extensions. | | I don't know if this is a bug, possibly related to the import of | Typeable stuff. I don't need a fix. I only want to point out that | globally switching on the option -fallow-incoherent-instances is likely | to break existing code, currently (ghc 6.2.2). | | Cheers Christian

Simon Peyton-Jones wrote:
Sorry.. but if you have all of undecidable instances overlapping instances incoherent instances then life is pretty wild.
It all only happened because I've put together third party code fragments that required various extensions. Thanks for your comments, Christian
participants (2)
-
Christian Maeder
-
Simon Peyton-Jones