[Haskell-cafe] Dividing integers?

Keith Wansbrough Keith.Wansbrough at cl.cam.ac.uk
Thu Mar 18 14:05:23 EST 2004


> Hello there! 
> 
> Although you might not believe it since I'm going to ask a very very
> very basic question, I have been using Haskell for educational
> purposes for a couple semesters now. Nevertheless, I don't think I
> have ever worked with non-Int number types! :)
> 
> I don't understand why I get this error. I mean, apparently "/" is
> not defined for integers but I don't know how to "cast" the result
> of the length function into a Double...

fromInteger or fromIntegral.  (the former converts an Integer to any
numeric type, the latter converts any integral type to any numeric type).

--KW 8-)



More information about the Haskell-Cafe mailing list