[snip]

: > > module Main( main ) where
: > > import List( genericLength )
: > > main = putStr (show integral) >>
: > >        putStr "\n"            >>
: > >        return ()
: > >      where integral = genericLength []

[snip]
 
: This is a legal Haskell program. The (ambiguous) type of `integral' is
: (Num a => a), but Haskell disambiguates numeric expressions with the
: help of `default' declarations. As per Haskell 1.4 (see section 4.3.4

Thanks for the pointer.

: of the report), this means resolving `integral' to be a value of type
: Int.

I think this ``resolving'' may lead to unwanted results. It took
me quite some time to discover that Integral was resolved to Int
in some program I had. Is there a possibility of generating a warning
message whenever programs like the one above have to be disambiguated?
Maybe a compiler-switch to turn these warning messages on and off?

: > ghc-3.01 thinks integral is an Int (a big
: > positive integral is sometimes shown as a
: > negative number).
: 
: ghc's implementation of Ints doesn't do overflow checking, so this is

Now there is something I did know.

: not too surprising. Disambiguate your program either by using type
: annotations telling the compiler that `integral' really is an Integer
: or use a `default' declaration.


Thanks again,


Marc

Reply via email to