summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/typecheck/should_compile/tc235.hs
blob: feeca6a998301f1b31df572baf8c6edd261ddbdd (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
29
30
31
32
33
34
35
36
37
38
39
{-# LANGUAGE FlexibleInstances, UndecidableInstances,
             MultiParamTypeClasses, FunctionalDependencies #-}

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