>>1As always, your criticism is stupid, and the best critique of Haskell comes from a Haskeller. Meet Conor McBride:
__________________________________________________________________________________________________________________
Find the type error in the following Haskell expression:
if null xs then tail xs else xs
You can’t, of course: this program is obviously nonsense unless you’re a typechecker. The trouble is that only certain computations make sense if the null xs test is True, whilst others make sense if it is False. However, as far as the type system is concerned, the type of the then branch is the type of the else branch is the type of the entire conditional. Statically, the test is irrelevant. Which is odd, because if the test really were irrelevant, we wouldn’t do it. Of course,
tail []
doesn’t go wrong –
well-typed programs don’t go wrong – so we’d better pick a different word for the way they do go.