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