diff options
Diffstat (limited to 'testsuite/tests/typecheck/should_run/tcrun033.hs')
-rw-r--r-- | testsuite/tests/typecheck/should_run/tcrun033.hs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_run/tcrun033.hs b/testsuite/tests/typecheck/should_run/tcrun033.hs new file mode 100644 index 0000000000..f9cf6a3faa --- /dev/null +++ b/testsuite/tests/typecheck/should_run/tcrun033.hs @@ -0,0 +1,31 @@ + +{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, FlexibleContexts, + UndecidableInstances, TypeSynonymInstances #-} + +-- This test made GHC 6.3 build a superclass loop, in +-- the instance ClassA a String declaration + +module Main where + +class (Sat (a -> b -> String), ClassB b) => ClassA a b + +class ClassB a where + fun :: a -> String + +class Sat x where + sat :: x + +instance ClassA a b => Sat (a -> b -> String) where + sat = const fun + +instance ClassA a String +-- Badness was that the ClassB superclass dict was loopy +-- +-- Needs Sat (a -> String -> String), ClassB String +-- --> ClassA a String, ClassB String +-- and adding ClassA gives superclass ClassB. + +instance ClassB String where + fun = id + +main = print ((sat :: Int -> String -> String) 3 "hello") |