[Hugs-users] Re: [Haskell] Hugs Nov2003 X Nov2002
ross at soi.city.ac.uk
Wed Mar 17 10:19:41 EST 2004
[redirected to hugs-users]
On Tue, Mar 16, 2004 at 11:46:50PM -0000, Stenio wrote:
> It is strange because fromInt works in the hugs prompt But when I use it in my
> haskell script it doesn´t work.
> Prelude>fromInt 5 :: Float (ok!)
> average :: Int -> Float
> average n = fromInt ( sum n ) :: Float / fromInt n :: Float
> doesn´t work...
> fromInteger works in hugs prompt and inside the haskell script too.
It's an accident (and arguably a bug) that it works at the prompt.
It happens because at the prompt you're inside the current module, and
when you don't have any module loaded, the Prelude is the current module.
It would be more consistent to make the default current module an empty
one instead of the Prelude, so you wouldn't see fromInt there either.
Bottom line: fromInt and other non-Haskell 98 things aren't supposed to
More information about the Hugs-Users