[Haskell-cafe] Int is broken [Was: Different answers on different machines]
Dan Doel
dan.doel at gmail.com
Mon Jun 3 00:42:08 CEST 2013
There is a package that implements an Int that throws an exception on
overflow:
http://hackage.haskell.org/package/safeint
Since Int's existence is pretty much all about trading for performance, I
wouldn't recommend holding your breath on the above becoming the default.
If you want things to work like Scheme, that's exactly what Integer is (in
GHC, anyhow). And Integer is what you get by default(ing) unless you use
something else that is specifically defined to use Int, or specify it
yourself.
On Sun, Jun 2, 2013 at 5:02 PM, Tommy Thorn <tt1729 at yahoo.com> wrote:
> On Jun 2, 2013, at 12:52 , Henry Laxen <nadine.and.henry at pobox.com> wrote:
>
> > Yes, that was it. The dell was a 32 bit system, and the desktop a 64. I
> > changed everything from Int to Integer, and now both agree. Thanks for
> the
> > pointer.
>
> Isn't that just terrible? I hate the fact that Haskell was defined to
> neither trap the overflow
> or just treat everything as Integer [like Scheme]. A sacrifice of program
> safety in the name
> of efficiency.
>
> I disagree with this choice and posit that a clever implementation can
> minimize the cost
> of the overflow checking in most relevant cases.
>
> I wish this fatal flaw would be reconsidered for the next major revision.
>
> Tommy
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130602/405d8776/attachment.htm>
More information about the Haskell-Cafe
mailing list