summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/tc117.hs
blob: d27c2b0076001cc30d47b596bc1086348c07c1ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies,
             FlexibleInstances, UndecidableInstances #-}
-- UndecidableInstances now needed because the Coverage Condition fails

-- !!! Functional dependencies
-- This one gave another fail in tcReadMutVar

module M1 where

class HasFoo a foo | a -> foo where
    foo :: a -> foo
instance HasFoo Int Int where
    foo = id

instance HasFoo a b => HasFoo [a] b where
    foo = foo . head

test:: [[Int]] -> Int
test = foo