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

Obviously there are some differences, but type classes are pretty similar to the way python normally works - type classes specify methods that a type has to have. So in the case of 'print', the type specifies that print can be called on anything that implements the method that turns a value into a string. The neat thing, of course, is that if you try to call it on something that doesn't implement that method, you get a compile error (and with proper tooling, I actually see red squiggles in my editor if I make this mistake, which is about as good as it can get).


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

Search: