sizeFM type

Simon Marlow simonmar at
Mon Apr 26 16:57:06 EDT 2004

On 26 April 2004 02:49, S. Alexander Jacobson wrote:

> Sun and Dell both sell 64-bit boxes.  But the core
> question is why have two different types at all?
> This issue is timely because I just got an error
> in code that looks vaguely like:
>    h<-openFile "foo" AppendMode
>    pos <- hFileSize h
>    hPutStr $ show something
>    hClose h
>    content <- readFile "foo"
>    return $ take pos content
> This code produces an error because (madness!):
>    hFileSize::Handle -> IO Integer
>    take::forall a. Int -> [a]->[a]
> I have to assume conversion between files and
> lists is not all that rare even in beginner code.
> Note: I don't really care whether everything is
> 64bit Int or Integer.  I just find having to care
> about this point in such trivial code ridiculous.

Probably if the take function were being designed today, there would be
no question about whether it should take Int or Integer.  Back then, the
Integer overhead was high enough to worry about, and lots of benchmark
programs used take/drop.  Nowadays, we can't really change the type of
take without breaking just about every Haskell program.


More information about the Glasgow-haskell-users mailing list