3 ms·
You’re making out having to explicitly specify a type when type inference doesn’t do a satisfactory job as some kind of extremely painful thing, but it’s not. Y
by minitech 10y ago
You’re making out having to explicitly specify a type when type inference doesn’t do a satisfactory job as some kind of extremely painful thing, but it’s not. You just define the type of your object, which is something you had to know anyways; now it’s written down and people reading don’t have to guess at or remember what it is.
- jstimpfle 10y agoAnnotating even the last bit of code that uses type class methods until the error message becomes clear is very cumbersome. For example, I can't say (traverse :: The List instance), but have to dig out the whole annoying signature, or go look for a more strategic value where the same information can be put in fewer characters. For another thing, it often duplicates the amount of lines needed (or more if you like to put in whitespace before types). It's definitely very annoying.
- dllthomas 10y ago> I can't say (traverse :: The List instance) Actually, in GHC 8.0 you can do exactly that, with the TypeApplictions extension. Prelude> :set -XTypeApplications Prelude> :t traverse @[] traverse @[] :: Applicative f => (a -> f b) -> [a] -> f [b]