3 ms·
Yeah, I know that the literal 1 has type Num a => a. Actually I suspect that's a bit of a flaw in Haskell. All the interesting things we can do with 1 as a lite
by cousin_it 11y ago
Yeah, I know that the literal 1 has type Num a => a. Actually I suspect that's a bit of a flaw in Haskell. All the interesting things we can do with 1 as a literal (like adding it to 1.5) are also things we could do with the length of a one-element list, but in Haskell these two 1's are not interchangeable. Also, defaulting rules seem to be a wart that's necessary only because of overloaded literals. Maybe the literal 1 could have type Integer, and 1 + 1.5 could work through some other kind of typeclass magic?