Testsuite: tabs -> spaces [skip ci]
[ghc.git] / testsuite / tests / typecheck / should_compile / tc081.hs
1 -- !!! an example Simon made up
2 --
3 module ShouldSucceed where
4
5 f x = (x+1, x<3, g True, g 'c')
6 where
7 g y = if x>2 then [] else [y]
8 {-
9 Here the type-check of g will yield an LIE with an Ord dict
10 for x. g still has type forall a. a -> [a]. The dictionary is
11 free, bound by the x.
12
13 It should be ok to add the signature:
14 -}
15
16 f2 x = (x+1, x<3, g2 True, g2 'c')
17 where
18 -- NB: this sig:
19 g2 :: a -> [a]
20 g2 y = if x>2 then [] else [y]
21 {-
22 or to write:
23 -}
24
25 f3 x = (x+1, x<3, g3 True, g3 'c')
26 where
27 -- NB: this line:
28 g3 :: a -> [a]
29 g3 = (\ y -> if x>2 then [] else [y])::(a -> [a])