<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>jolmg</author><text>I like how Haskell does it. When you simply write a number like &amp;quot;3&amp;quot; it will infer the type to be &amp;quot;Num a =&amp;gt; a&amp;quot; which means it could be any type you have loaded that defines the functions in the typeclass Num:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    class Num a where
      (+) :: a -&amp;gt; a -&amp;gt; a
      (-) :: a -&amp;gt; a -&amp;gt; a
      (*) :: a -&amp;gt; a -&amp;gt; a
      negate :: a -&amp;gt; a
      abs :: a -&amp;gt; a
      signum :: a -&amp;gt; a
      fromInteger :: Integer -&amp;gt; a
&lt;/code&gt;&lt;/pre&gt;
&amp;quot;3.0&amp;quot; would be &amp;quot;Fractional a =&amp;gt; a&amp;quot; which means it defines the functions in the typeclass Fractional (in addition to being a Num):&lt;p&gt;&lt;pre&gt;&lt;code&gt;    class Num a =&amp;gt; Fractional a where
      (&amp;#x2F;) :: a -&amp;gt; a -&amp;gt; a
      recip :: a -&amp;gt; a
      fromRational :: Rational -&amp;gt; a
&lt;/code&gt;&lt;/pre&gt;
Depending on how you use the value, the type would be further refined in compile-time. For example, if you did `recip 3`, 3 couldn&amp;#x27;t be any Num anymore, it would have to be some Fractional.&lt;p&gt;Regarding (5&amp;#x2F;3)*6, it does equal 10 using floating point. A better example would be how 0.1 + 0.2 is not equal to 0.3. We can see this:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    ghci&amp;gt; 0.1 + 0.2 == (0.3 :: Float)
    False
&lt;/code&gt;&lt;/pre&gt;
If we specified that we&amp;#x27;re working with Rational values, which are also Fractional a =&amp;gt; a, and which are defined as a pair of integers, one representing a numerator and the other a denominator, roughly like so:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    type Rational = Ratio Integer
    data Ratio a = a :% a
&lt;/code&gt;&lt;/pre&gt;
then we can see that 0.1 + 0.2 does equal to 0.3:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    ghci&amp;gt; 0.1 + 0.2 == (0.3 :: Rational)
    True
&lt;/code&gt;&lt;/pre&gt;
It&amp;#x27;s pretty cool that Haskell lets you define new types of numbers and use them like any other. While you can transparently support hardware type numbers, represented by types like Int, Float, Double, Word, Word8, Word16, Word32, Word64, you also have transparent support for arbitrary precision Integer and Rational. Writing your functions to work with the typeclasses like Num and Fractional lets your functions work with any of these types and future types defined.</text><parent_chain><item><author>joppy</author><text>I’m hoping that &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;golang&amp;#x2F;go&amp;#x2F;issues&amp;#x2F;19623&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;golang&amp;#x2F;go&amp;#x2F;issues&amp;#x2F;19623&lt;/a&gt; will come through, and we’ll get a native “true integer” type (and hopefully a rational one as well, though maybe this is pushing it a bit). This is really something that should be implemented at the language level, so that “int” can become a true integer, yet still remain efficient in many cases.&lt;p&gt;It is bizarre to me that languages boasting built-in language-level data structures like lists, hashtables, etc are content to just leave us with the bare minimum support of &lt;i&gt;numbers&lt;/i&gt;, being basically whatever the hardware thinks a number is. The semantics of integers and fractions are perfect, and everybody already knows them. On the other hand, overflows in int32’s are weird, and if your idea of a fraction is a floating-point number, then you can never have something like (5&amp;#x2F;3)*6 evaluate to 10 exactly.&lt;p&gt;To be clear, I think fixed-width integers and floating-point numbers have their place, I just see no reason why they should be the default.</text></item></parent_chain></comment><story><title>Go 2, here we come</title><url>https://blog.golang.org/go2-here-we-come</url></story>
<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>tigershark</author><text>I am misunderstanding or really go is using the ‘int’ type that can be 32 or 64 bit depending on the system that it runs on???
If this is the case I think that is crazy and I can’t think of any useful use case for it.
If it’s not the case then please explain me what that proposal is really about...</text><parent_chain><item><author>joppy</author><text>I’m hoping that &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;golang&amp;#x2F;go&amp;#x2F;issues&amp;#x2F;19623&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;golang&amp;#x2F;go&amp;#x2F;issues&amp;#x2F;19623&lt;/a&gt; will come through, and we’ll get a native “true integer” type (and hopefully a rational one as well, though maybe this is pushing it a bit). This is really something that should be implemented at the language level, so that “int” can become a true integer, yet still remain efficient in many cases.&lt;p&gt;It is bizarre to me that languages boasting built-in language-level data structures like lists, hashtables, etc are content to just leave us with the bare minimum support of &lt;i&gt;numbers&lt;/i&gt;, being basically whatever the hardware thinks a number is. The semantics of integers and fractions are perfect, and everybody already knows them. On the other hand, overflows in int32’s are weird, and if your idea of a fraction is a floating-point number, then you can never have something like (5&amp;#x2F;3)*6 evaluate to 10 exactly.&lt;p&gt;To be clear, I think fixed-width integers and floating-point numbers have their place, I just see no reason why they should be the default.</text></item></parent_chain></comment><story><title>Go 2, here we come</title><url>https://blog.golang.org/go2-here-we-come</url></story>