The author includes a perfect (if unintentional) example of why Haskell programs shouldn't use `error`. (If you're writing a quick-and-dirty program? Fair enough. But not in larger programs.)
He defines a `Lattice` class, and explains that if a type implements the `Lattice` class, it supports all the operations within the `Lattice` class.
He then presents an implementation of the `Lattice` class that doesn't support all the `Lattice` operations (`top` punts to `error`). It breaks the promise, breaks the contract, undermines the guarantees the type system gives you.
So don't use `error` in Haskell. (And for that matter, don't use other partial functions such as `head` and `tail`.)
why not say assembler "is a must for understanding how a program works"? because when you are talking about the underlying machine, that's what you mean.
but if you are not speaking about the machine, but the program (algorithms within) a higher-level language might even lead to better understanding because you can focus on the important parts. that language does not have to be functional (some algorithms _are_ imperative) but might be, say, python.
Assembly is also good and I spent a semester teaching it to 2nd semester students. I think C++ is a better choice because it exposes folks to low level programming in a more controlled fashion.
Knowing OOP is also useful, and knowing how OOP behaves on a machine is also useful (vtables). I can't recommend Scheme or Lisp because it will leave students disconnected from the real-world software stack.
well. of course knowing oop is useful. but why the modula flavor and not the smalltalk flavor? vtables cannot be used with message-passing object orientation.
shouldn't students learn lambda-calculus? shouldn't you teach a functional programming language then? or even a logic programming language? "the real-world software stack" is not the most important thing in the world.
He defines a `Lattice` class, and explains that if a type implements the `Lattice` class, it supports all the operations within the `Lattice` class.
He then presents an implementation of the `Lattice` class that doesn't support all the `Lattice` operations (`top` punts to `error`). It breaks the promise, breaks the contract, undermines the guarantees the type system gives you.
So don't use `error` in Haskell. (And for that matter, don't use other partial functions such as `head` and `tail`.)