[project @ 1997-07-30 23:52:45 by sof]
[ghc-hetmet.git] / ghc / compiler / tests / typecheck / should_succeed / 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 = (\ y -> if x>2 then [] else [y])::(a -> [a])