3 ms·
Am I the only one who thinks in types? Whether I'm coding Ruby, C, or Haskell, I'm always conscious of what type signature the function I'm writing has. "Okay,
by losvedir 15y ago
Am I the only one who thinks in types? Whether I'm coding Ruby, C, or Haskell, I'm always conscious of what type signature the function I'm writing has.
"Okay, this function will take two arguments, one will be an integer, and one will be a string, and it will return a list of strings."
It helps me reason about my code since I'm never going to want to, say, add an integer to a string, without some intentional type conversion in there.
I'm diving into haskell at the moment and really liking it. I always notated to myself what types a function took and returned, even if it was just in a comment, but with haskell there's a notation for it, and the compiler is pretty sophisticated about making sure that type-wise my function is doing what I'm expecting it to be doing.