<div class="gmail_quote">2009/3/20 Brandon S. Allbery KF8NH <span dir="ltr">&lt;<a href="mailto:allbery@ece.cmu.edu">allbery@ece.cmu.edu</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On 2009 Mar 20, at 18:01, Sean Bartell wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
For a type &quot;a&quot; to be Fractional requires there to be:<br>
(/) :: a -&gt; a -&gt; a<br>
You can&#39;t divide an Int by another Int and (in general) get a third<br>
Int. You would probably want something like a &quot;Fractionable&quot;<br>
typeclass, with<br>
(/) :: a -&gt; a -&gt; b<br>
which would result in a Rational, but Haskell doesn&#39;t have this.<br>
</blockquote>
<br>
<br></div>
...but there is (%) :: (Integral a) =&gt; a -&gt; a -&gt; Ratio a<br><font color="#888888">
</font></blockquote></div><br>Thanks, I knew about % but didn&#39;t remember about it when I was working on this sample :)  So that being said, consider the following:<br><br>Prelude Data.Ratio&gt; let x = 5::Int<br>Prelude Data.Ratio&gt; :t x<br>
x :: Int<br>Prelude Data.Ratio&gt; :t (x%3)<br>(x%3) :: Ratio Int<br>Prelude Data.Ratio&gt; let y = truncate (x%3)<br>Prelude Data.Ratio&gt; :t y<br>y :: Integer<br><br>Why does y now have the type Integer instead of Int?  <br>