On the long errors part - writing typedefs often helps when the code has
complicated types. The compiler tries to replace matching parts of types
in error messages with the typedef names, whenever possible. It also tries
to omit parts of types that are not involved in the error.
I'm partially commenting because the initial naive error reporting that
the compiler once had was really quite terrible - competing with the C++
templates by spitting out error message consisting of types that filled
few pages of terminal window (and then stating that too bad, those types
don't match). So the HM inference has a potential for awful error
messages, but fortunately it's (mostly) curable disease here.
Another thing that helps is localizing type errors by declaring top-level
function types.
Both of these things can be done later than initially writing code. I've
sometimes written first "prototype" implementation without any type
declarations and then later converted it into "real" code by adding
declarations where it seems useful (to make it easier to maintain and
understand).
--
Reading or distributing any bit from this message is strongly prohibited.