id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	os	architecture	failure	difficulty	testcase	blockedby	blocking	related
5095	Incoherent instance for Prelude type class accepted without incoherent instances option	brunosoliveira		"If we create a new module allowing overlapping instances, flexible instances and undecidable instances we can define a function that selects an incoherent instance for a type class defined in the Prelude. Example:
{{{
> {-# OPTIONS -XFlexibleInstances -XOverlappingInstances -XUndecidableInstances #-}

> module Test where

> instance Show a => Eq a where
>   x == y =  length (show x) == length (show y)
>
> f :: Show a => a -> a -> Bool
> f x y = x == y
>
> p = f (3 :: Int) 4
}}}
The instance selected here (tested with GHC 7.0 and 6.12) is the one in this module, even if the instance Eq Int from the Prelude is more specific. If we try to reproduce a similar example using a module other than the Prelude, an incoherent instances error is reported. I believe that, for consistency the same should happen here."	bug	closed	normal	7.4.1	Compiler (Type checker)	7.0.1	fixed			Unknown/Multiple	Unknown/Multiple	GHC accepts invalid program		typecheck/should_fail/T5095			
