summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/tc152.hs
blob: 43f107365db8973e0ea070d300c41e0cabab8644 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies,
             UndecidableInstances #-}
-- -XUndecidableInstances now needed because the Coverage Condition fails

-- This one blew up Hugs (Apr 02)

module ShouldCompile where

--  Context reduction can introduce opportunities for context improvement,
--  so add an additional `improve' step afterwards.  The bug is demonstrated by
--  the following code:
  
  class C a b c | a b -> c where
    m :: a -> b -> c
  
  instance C Integer Integer Integer where
    m = error "urk" 
 
  newtype T a = T a
  
  instance C a b c => C (T a) (T b) (T c) where
    m = error "urk" 
  
  i :: T Integer
  i = undefined
  
  x = m (m i i) i -- This line blows up w/ unresolved top-level overloading