Haskell's type system can also express interesting things most languages' type systems can't.<p>For example:<p><a href="https://github.com/yairchu/red-black-tree/blob/master/AvlTree.hs" rel="nofollow">https://github.com/yairchu/red-black-tree/blob/master/AvlTre...</a> -- in lines 13..21, an AVLTree type is defined -- with its invariants encoded in the type system. If there's a mistake in these 9 lines, you may get a wrong program. But the nice thing is that if you get just these 9 lines right -- then the hundreds of lines below it that implement an AVL tree <i></i>cannot get the AVL invariants wrong<i></i>.<p>The same is also true for Red Black Trees:
<a href="https://github.com/yairchu/red-black-tree/blob/master/RedBlackTree.hs" rel="nofollow">https://github.com/yairchu/red-black-tree/blob/master/RedBla...</a><p>Lines 26..36 inclusive encode the RBTree type such that the invariants are enforced by the type-checker.<p>In case this is unclear: the type-checker enforcing the correctness of the invariants is at <i>compile-time</i>. A running program is a correct program, at least from the invariants' perspective.
"Oh look, Haskell is great! Why? Static typing and concise code and no side effects!"<p>I don't disagree on any particular point, but this is hardly news (on HN, at least), and is rather lacking in substance.