sizeFM type

S. Alexander Jacobson haskell at alexjacobson.com
Sun Apr 25 22:48:45 EDT 2004


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.

And re sizeFM, I would note that Google has more
than 2^31 pages indexed in memory.

-Alex-

_________________________________________________________________
S. Alexander Jacobson                  mailto:me at alexjacobson.com
tel:917-770-6565                       http://alexjacobson.com


On Sun, 25 Apr 2004, David Roundy wrote:

> On Sun, Apr 25, 2004 at 03:20:42PM -0400, S. Alexander Jacobson wrote:
> >
> >   QUESTION: "I read in a newspaper that in l981 you
> >   said '640K of memory should be enough for
> >   anybody.' What did you mean when you said this?"
> >
> >   ANSWER: "I've said some stupid things and some
> >   wrong things, but not that. No one involved in
> >   computers would ever say that a certain amount of
> >   memory is enough for all time."
> >
> >   http://www.wired.com/news/print/0,1294,1484,00.html
> >
> > Dell's Poweredge servers address up to 32GB of
> > memory today!  There are already 5.7 billion
> > people on the planet (>2^31) and 741 million phone
> > lines.  In my mind, there is NO QUESTION that 2^31
> > keys is a reasonable size for a FiniteMap or will
> > be in the very very near future.
>
> On the other hand, since they are still 32 bit computers, any given
> application can still only access 4G of memory.  This issue will only be a
> problem on 64 bit platforms which have a 32 bit Int.
>
> > Moreover, it is not clear that the CPU/memory
> > overhead of returning Integer rather than Int for
> > sizeFM is sufficiently high to be worth bothering
> > the programmer about.
>
> I'd say that rather than returning an Integer, we'd be better off just
> using a 64 bit Int on 64 platforms.
> --
> David Roundy
> http://www.abridgegame.org
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>



More information about the Glasgow-haskell-users mailing list