3 ms·
Just None, like Just Nothing is nonsense. If you have a special marker for something, just explicitly check for it each time.
by dschiptsov 12y ago
Just None, like Just Nothing is nonsense.
If you have a special marker for something, just explicitly check for it each time.
- dschiptsov 12y agoOK, lets make it long and explicit. Asserting that an obscure, optional either-of type is some fundamental concept every single language has been overlooked is, of course, nonsense. The fundamental concept is notion of "nothingness", "emptiness", what other languages call NIL. Without this a language would be very clumsy, like Math without zero. The notion of empty vs. non-empty is captured in so-called "either-of" types. The most obvious example is '() - an empty list. Conceptually, it is a List, but it is also indicator of "emptiness", of "nothing inside". A List is an "either-of type" itself, so it does not require any additional specialize type to capture the notion that it could be empty - it already has it. Another example is so-called "C-strings". There is notion of end-of-string marker, so a string could be viewed as a list instead of an array of characters. In this case (of a list) we don't have define anything special for "empty string" - the notion of "just end-of-string marker" is good-enough. Again. This Just/Nothing type in Haskell is nothing special or fundamental. It is an optional, non-essential construct.
- tome 12y agoThe article explains exactly why it is useful to be able to distinguish `Nothing` from `Just Nothing`.
- dschiptsov 12y agoYeah, instead of having only "nothing" - NIL - they prefer to have "nothing-in-a-box", and "nothing-in-a-bag", and "nothing-in-a-suitcase". Nothing-in-a-container-of-this-kind. Due to such over-abstraction madness for sake of abstraction they end up with Java or Javaesque Haskell code.