3 ms·
In the section on "Boolean Blindness", I find the example a bit confusing. I would expect `isNotJust (Just foo)` to equal `False`, not `True`, and vice versa `
by anaphor 7y ago
In the section on "Boolean Blindness", I find the example a bit confusing.
I would expect `isNotJust (Just foo)` to equal `False`, not `True`, and vice versa `isNotJust Nothing` to equal `True`.
The point has some validity (that you should try to encode data into the types if you can), but the example makes no sense in my opinion.
http://dev.stephendiehl.com/hask/#boolean-blindness http://dev.stephendiehl.com/hask/#boolean-blindness
- runaway 7y agoI thought that was the point of the section- that you may be able to tell something is wrong with the example, but the compiler can't. Thus by programming in that fashion you're not taking advantage of the power of the compiler. The improved way below where the Just a is unwrapped with a case allows the compiler to see whether or not x is valid.
- anaphor 7y agoAh ok, that wasn't really clear to me, but that makes way more sense. Clearly I hadn't had any coffee when I read it earlier.
- lonelappde 7y agoThat's what these parts were going for: > Is there anything wrong with the definitions and below > and why is this not caught in the type system? And > ??? on the line you flagged as a bug.