<div dir="ltr">Indeed, as Dan says, theres the safeint library and the Integer type. <div><br></div><div style>If the Int type had either of these semantics by default, many many performance sensitive libraries would suddenly have substantially less compelling performance.  Every single operation that was branchless before would have a branch *every* operation..... this would be BAD.  </div>

<div style><br></div><div style>I&#39;m actually quite happy with (ab)using Int as just a sequence of bits that sometimes i treat as a number, and sometimes i treat as a bitvector. In fact thats actually most of my work these days. GHC generates VERY nice code for Ints and Words, similar to what i&#39;d expect to be Generated by a decent C compiler when not explicitly using SIMD operations.  This is a good thing!</div>

<div style><br></div><div style>Additionally, theres work in progress to support &quot;branchless&quot; Bool operations in GHC by having Bool be represented internally With 0,1 valued Ints, <a href="http://hackage.haskell.org/trac/ghc/wiki/PrimBool">http://hackage.haskell.org/trac/ghc/wiki/PrimBool</a> </div>

<div style><br></div><div style>point being: its easy to have the safety with SafeInt, or Using Integer, and fast inner loops can&#39;t have branches, and that actually matters in many applications.</div><div style><br></div>

<div style>cheers</div><div style>-Carter</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jun 2, 2013 at 6:42 PM, Dan Doel <span dir="ltr">&lt;<a href="mailto:dan.doel@gmail.com" target="_blank">dan.doel@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>There is a package that implements an Int that throws an exception on overflow:<br><br>    <a href="http://hackage.haskell.org/package/safeint" target="_blank">http://hackage.haskell.org/package/safeint</a><br>

<br>
</div>Since Int&#39;s existence is pretty much all about trading for performance, I wouldn&#39;t recommend holding your breath on the above becoming the default.<br><br></div>If you want things to work like Scheme, that&#39;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.<br>


<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jun 2, 2013 at 5:02 PM, Tommy Thorn <span dir="ltr">&lt;<a href="mailto:tt1729@yahoo.com" target="_blank">tt1729@yahoo.com</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Jun 2, 2013, at 12:52 , Henry Laxen &lt;<a href="mailto:nadine.and.henry@pobox.com" target="_blank">nadine.and.henry@pobox.com</a>&gt; wrote:<br>



<br>
&gt; Yes, that was it.  The dell was a 32 bit system, and the desktop a 64.  I<br>
&gt; changed everything from Int to Integer, and now both agree.  Thanks for the<br>
&gt; pointer.<br>
<br>
Isn&#39;t that just terrible? I hate the fact that Haskell was defined to neither trap the overflow<br>
or just treat everything as Integer [like Scheme]. A sacrifice of program safety in the name<br>
of efficiency.<br>
<br>
I disagree with this choice and posit that a clever implementation can minimize the cost<br>
of the overflow checking in most relevant cases.<br>
<br>
I wish this fatal flaw would be reconsidered for the next major revision.<br>
<br>
Tommy<br>
<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div>