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

Type abstractions are fundamentally hierarchical

In C++ or Java they certainly are, but Haskell's type classes, for instance, are much more similar to Go's interfaces.



I don't think anyone is going to say that Haskell's type classes in any way fit the traditional notion of a type. It's more the exception that proves the rule in this case.


I know it's a common saying, but I've never understood how exceptions can prove rules.


It is a very old saying from when "prove" meant what "test" means now. Exception is meant in the sense of exceptional, unusual. "The unusual event tests the heuristic."


It's actually a really simple thing that most people misunderstand (such as the parent). It means that if you only provide an exception, it implies a rule. For example, if you say:

Parking allowed 3pm-5pm

that implies that parking is not allowed at other times.


It's just something stupid that people say when they've been caught over-generalizing.


Pointing out how flexible Haskell's type system is just proves how inflexible type systems generally are. It doesn't really demonstrate that most type systems are useful.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: