Commit 6077c7d6 authored by simonpj's avatar simonpj
Browse files

[project @ 2005-03-07 17:12:05 by simonpj]

Test recursive dictionaries
parent cd8d1929
......@@ -37,6 +37,8 @@ test('tcrun028', expect_fail_for(['extcore','optextcore']), compile_and_run, [''
test('tcrun029', normal, compile_and_run, [''])
test('tcrun030', normal, compile_and_run, [''])
test('tcrun031', only_compiler_types(['ghc']), compile_and_run, [''])
test('tcrun032', only_compiler_types(['ghc']), compile_and_run, [''])
test('tcrun033', only_compiler_types(['ghc']), compile_and_run, [''])
test('church', normal, compile_and_run, [''])
test('testeq2', normal, compile_and_run, [''])
{-# OPTIONS -fglasgow-exts -fallow-undecidable-instances #-}
-- This tests the recursive-dictionary stuff.
--
-- The derived instance needs
module Main where
data Fix f = In (f (Fix f)) deriving( Show, Eq )
data L x = Nil | Cons Int x deriving (Show, Eq)
main = do { print (In Nil);
print (In Nil == In Nil) }
{-# OPTIONS -fglasgow-exts -fallow-undecidable-instances #-}
-- 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")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment