Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

If it typecheks ship it! XD

Name: Anonymous 2015-04-28 1:22

Name: Anonymous 2015-04-30 20:52

>>1
As 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.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List