Testsuite: tabs -> spaces [skip ci]
[ghc.git] / testsuite / tests / typecheck / should_compile / tc098.hs
1 -- !!! Ambiguity in local declarations
2
3 module ShouldSucceed where
4
5 type Cp a = a -> a -> Ordering
6
7 m :: Eq a => Cp a -> [a] -> a
8 m _ [x,y,z] = if x==y then x else z
9
10 cpPairs :: Cp [j] -> (a,[j]) -> (a,[j]) -> Ordering
11 cpPairs cp (_,p) (_,q) = cp p q
12
13 mp :: (Eq i,Eq j) => Cp [j] -> [(i,[j])] -> (i,[j])
14 mp cp dD =
15 let minInRow = m (cpPairs cp)
16 in minInRow dD
17
18 {- GHC 3.02 reported
19
20 T.hs:24:
21 Ambiguous type variable(s)
22 `j' in the constraint `Eq (aYD, [j])'
23 arising from use of `m' at T.hs:24
24 In an equation for function `mp':
25 mp cp dD = let minInRow = m (cpPairs cp) in minInRow dD
26
27 This was because the ambiguity test in tcSimplify didn't
28 take account of the type variables free in the environment.
29
30 It should compile fine.
31 -}