tc235.hs 704 Bytes
Newer Older
simonpj's avatar
simonpj committed
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
29
30
31
32
33
34
35
36
37
38
{-# OPTIONS -fglasgow-exts -fallow-undecidable-instances #-}

-- 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 ()