summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/typecheck/should_compile/tc118.hs
blob: 5828a1287c169e63a93a4c1ec9aebe6603598fda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies,
             UndecidableInstances #-}

-- !!! An instance decl with a context containing a free type variable
-- The interest here is that there's a "b" in the instance decl
-- context that isn't mentioned in the instance head.  
-- Hence UndecidableInstances

module ShouldCompile where

class HasConverter a b | a -> b where
   convert :: a -> b
 
data Foo a = MkFoo a

instance (HasConverter a b,Show b) => Show (Foo a) where
   show (MkFoo value) = show (convert value)