No safety in numbers

Konrad Hinsen hinsen@cnrs-orleans.fr
Thu, 21 Aug 2003 23:36:34 +0200


On Thursday 21 August 2003 23:23, Jon Cast wrote:
> > I can make such a declaration, but it still gets converted to Double.
>
> How are you doing this?  I'm not seeing the behavior you describe.

module Foo where
x =3D 0.5 :: Fractional a =3D> a

Then I run "hugs Foo.hs" and get:

Foo> :type x
x :: Double

Same with ghci.


An even better illustration of my original problem is:

module Foo where

x =3D 0.5 :: Fractional a =3D> a

foo :: Fractional a =3D> a -> a
foo a =3D x*a


This yields the error message

ERROR "/home/hinsen/haskell/Foo.hs":6 - Inferred type is not general enou=
gh
*** Expression    : foo
*** Expected type : Fractional a =3D> a -> a
*** Inferred type : Fractional Double =3D> Double -> Double

Konrad.