[Haskell-beginners] Puzzling type error

Yitzchak Gale gale at sefer.org
Sun Aug 24 14:25:40 EDT 2008


Logesh Pillay wrote:
> Since this involves whole numbers only, I was surprised by the following
> run-time error...

The type of logBase is Floating a => a -> a -> a
So by using b as an argument to logBase, you
are forcing it to be in a type that is an instance of
Floating.

Use "fromIntegral b".

Regards,
Yitz


More information about the Beginners mailing list