diff options
Diffstat (limited to 'testsuite/tests/typecheck/should_compile/tc235.hs')
-rw-r--r-- | testsuite/tests/typecheck/should_compile/tc235.hs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/tc235.hs b/testsuite/tests/typecheck/should_compile/tc235.hs new file mode 100644 index 0000000000..feeca6a998 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/tc235.hs @@ -0,0 +1,39 @@ +{-# LANGUAGE FlexibleInstances, UndecidableInstances, + MultiParamTypeClasses, FunctionalDependencies #-} + +-- Trac #1564 + +module Foo where + +import Text.PrettyPrint +import Prelude hiding(head,tail) + +class FooBar m k l | m -> k l where + a :: m graphtype + +instance FooBar [] Bool Bool where + a = error "urk" + +instance FooBar Maybe Int Int where + a = error "urk" + +class (Monad m)=>Gr g ep m | g -> ep where + x:: m Int + v:: m Int + +instance (Monad m, FooBar m x z) => Gr g ep m where + x = error "urk" + v = error "urk" + +-- Old GHC claims for y: y :: (Monad m, FooBar m GHC.Prim.Any GHC.Prim.Any) +-- => m Int (which is wrong) +-- The uses in foo and bar show if that happens +y () = x + +foo :: [Int] +foo = y () + +bar :: Maybe Int +bar = y () + + |