-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing smart constructors in Section 6.1? #7
Comments
Nice catch! What's missing in the text (but not the code) is algebra-driven-design/code/Scavenge/InputFilter.hs Lines 54 to 56 in eeab5a0
Observe for InputFilter s. The important bit here is that we're looking at observations of InputFilter with respect to match , so the actual constructors need not be clever, since the homomorphism into booleans is "obvious." Admittedly a bad omission though!
|
Thanks for the reply! I see, so if I understand correctly, all of the equalities that equate two matches never = matches (notF always) |
Exactly right! Sorry for the confusion :) |
That leaves one more question: if our QuickSpec properties are always just concerned with observational equality (which makes sense to me), why bother with pattern matching on e.g.
flipH (FlipH t) = t
flipH t = FlipH t Of course algebraic equality implies observational equality, so that's fine in principle. But it seems unnecessary, and I can't find any motivation for it in the book. It seems to me that the properties would also hold if we were to leave the pattern matching out. Is that correct? |
I'm working through the book, and there seems to be something lacking in Section 6.1.
At the end of the section, the equations found by QuickSpec are listed, such as
However, these equations (as well as some others) don't seem to be true, because
Never
is not the same algebraic value asNot Always
.Contrast with Section 5.1, where this issue is specifically addressed:
and then proceeds to modify the constructors to be "smart", such that the laws indeed hold algebraically.
Is this part simply missing from Section 6.1?
The text was updated successfully, but these errors were encountered: