[project @ 1996-01-08 20:28:12 by partain]
[ghc-hetmet.git] / ghc / compiler / tests / typecheck / should_succeed / tc084.hs
1 {- This program shows up a bug in the handling of
2    the monomorphism restriction in an earlier version of
3    ghc.  With ghc 0.18 and before, f gets a type with
4    an unbound type variable, which shows up in the
5    interface file.  Reason: it was being monomorphised.
6
7    Simon PJ
8 -}
9
10 module Foo where
11
12
13 g :: Num a => Bool -> a -> b -> a
14 g b x y = if b then x+x else x-x
15
16 -- Everything is ok if this signature is put in
17 -- but the program should be perfectly legal without it.
18 -- f :: Num a => a -> b -> a
19 f = g True
20
21 h y x = f (x::Int) y
22         -- This use of f binds the overloaded monomorphic
23         -- type to Int