3 ms·
See my reply to happy4crazy. Your examples are interesting, but I still think that to say that bottom is an element of every Haskell type is to commit a level
by ScottBurson 15y ago
See my reply to happy4crazy. Your examples are interesting, but I still think that to say that bottom is an element of every Haskell type is to commit a level confusion. It would be more accurate to simply say that expressions and variables in Haskell don't always have values. What your examples show is simply that the language is not strict: an expression can have a value even if one of its subexpressions does not.
In mathematics, we don't have this notion of a variable with no value, so to write a formal semantics for Haskell we have to make up this "meta-value" bottom. But it should not be confused with a value in the language, as it is not one.
Again, this is all my intuition and I'm not an expert. But so far, I don't see what's wrong with this view.
- Periodic 15y agoIn comparison to math, I think bottom is very close to the idea of an undefined value. What is the value of 4/0? What is the derivative of a step function at 0? Mathematics often goes out of its way to make sure things aren't undefined by defining domains that exclude the undefined values. In programming we do the same thing most of the time. I think what I missed is that bottom in Haskell is really an exception. It's a value that doesn't really exist. Trying to force it gives an exception. The real results of a computation are concrete values, non-termination and exceptions.