summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/typecheck/should_compile/LoopOfTheDay3.hs
blob: dce1601a70544da3aa372293e1bac4eeea604a6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances,
             OverlappingInstances, UndecidableInstances #-}

-- Instances compile fine but instance selection loops in GHC 6.2.
-- try: :t foo (T1a 1)
-- This is essentially the same as LoopOfTheDay2.hs
-- but with the innocent (?) use of overlapping instances.

module ShouldCompile where 

data T1 = T1a Int | T1b T1

class C0 x where foo :: x -> (); foo = undefined
class C1 x y
class C1 x y => C2 x y

instance C0 a                => C1 () a
instance (C1 x T1, C1 x Int) => C2 x T1
instance C1 x Int            => C2 x Int
instance C2 () a             => C0 a

baz = foo (T1b (T1a 3))