Ive come across some answers (here in SO) saying that Haskell has many “dark corners” in its type system, and also some messy holes. Could someone elaborate on this?
Thanks in advance
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I guess I should answer this, especially since two people so far have misinterpreted my remarks…
Regarding non-termination, the remark in question was slight hyperbole for dramatic effect, and referred to non-termination at the value level. This was in context of comparing Haskell to theorem provers, in an answer to someone who mentioned type-enforced correctness properties as something they particularly appreciated. In that sense, the presence of ⊥ inhabiting otherwise empty types is a “flaw”, because it changes the meaning of a type like
A -> Bfrom “given an A, produces a B” into “given an A, either produces a B or crashes the program” which is, for obvious reasons, somewhat less satisfying from a proof-of-correctness standpoint.It’s also completely irrelevant to almost all day-to-day programming and no worse than any other general-purpose language because, of course, the possibility of non-termination is required for Turing-completeness.
I don’t have any problem with
UndecidableInstances. Actually, it bothers me less than ⊥ at the value level does because it only crashes GHC when compiling, not the finished program.OverlappingInstancesis another matter, though, and the ad hoc mishmash of GHC extensions to provide little bits of things that would most naturally require dependent types certainly qualifies as “messy”.But keep in mind that most of the things I’m complaining about in Haskell are only a problem because of the otherwise very solid foundation. Most type systems in other statically typed languages aren’t even coherent enough to be called “wrong” in comparison, and cleaning up the stuff I’m calling “messy” is an active and ongoing area of research.