Ad
  • Custom User Avatar

    x:xs needs to be wrapped in parentheses

  • Custom User Avatar

    I've read about a proposal. But it doesn't matter, since my argument was of hypothetical nature. The Show class is used to produce a text representation of a value, which can be easily read back in with the Read class, and nothing more.

  • Custom User Avatar

    And what if they allow 20000 to be written as a new kind of literal 2e4 […]

    Isn't 2e4 :: Fractional a => a per section 2.5? Do you have a link for 2e4 :: Num a => a? Also, section 9 specifies instance Show Integer as showsPrec = showSigned showInt, which shows an integral number in base 10.

  • Custom User Avatar

    That's exactly the point. And what if they allow 20000 to be written as a new kind of literal 2e4, then it could also be reflected in the Show instance.

    People make assumptions about things, which probably will not hold. Bad code style.

  • Custom User Avatar

    You can even eta reduce that snippet to digits = map digitToInt . show. Either way, this will fail on negative input, such as -1234563.