Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

From your link:

"...I actually had no idea how the function worked. I simply wrote a function that matched the required type."

I guess everybody have done that. But releasing it without testing... I'm just impressed, in both a good and a bad way.



Huh, you know, that sounds just like how dimensional analysis affects people sometimes. I've certainly seen some take a pile of engineering inputs and whack them together until the units work (myself included); it's a shockingly powerful heuristic for linear systems, since you'll typically only be off by some logical scaling factor. Of course, there's a bajillion ways it can deceive, so it's wise to be thorough.


It seems entirely reasonable to me to view dimensional analysis as a type system itself.


It has to do with how abstract and parametric the code was. There may very well be only one valid type-checking program which exists (so long as you do a cursory check against infinite loops and error throwing).

So, it's a gamble---do there exist any other non-trivial programs at this type?

If not, then I know my code written is correct without testing.

If there are, then I'm risking that I found the right one.

This is why Haskellers get so excited about "parametricity". It's the core tool that exacts this property of "there are only a small number of programs which could ever exist at this type" which drives correctness.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: