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

-- !!! 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