summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/typecheck/should_compile/tc096.hs
blob: 165c5bd6367bcf7336217083f0f53d062bb60758 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
module ShouldSucceed where

-- !!! monomorphism restriction and defaulting

x = 3

main = print $ 6 / x

{-
Hugs 1.4 complains: ERROR "Strange.hs" (line 3): Int is not an
instance of class "Fractional".  GHC however compiles the program.
Substitute for x and Hugs is happy.  What's going on?

I haven't studied the numeric classes much so perhaps I'm missing
something obvious here.  (I see that the bugs page alludes to some 1.4
features not in Hugs leading to type errors.  If this is it, maybe you
should give it as an example?)

  Bjarte

------- Message 2

Date:    Wed, 25 Feb 98 14:01:35 -0500
From:    "John C. Peterson" <peterson-john@CS.YALE.EDU>
To:      bjartem@idi.ntnu.no
cc:      hugs-bugs@CS.YALE.EDU
Subject: Re: Fractional and Int?

This is a known hugs bug.  x should be monomorphic, allowing the usage
in main to constrain it to Fractional.  Instead, it is generalized and
then defaulted to Int without being influenced by main.  So ghc is
right and hugs is wrong on this one.  I expect this will be fixed
eventually. 

   John
-}