-
-
Notifications
You must be signed in to change notification settings - Fork 195
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
We should probably enforce in Travis that our stub solutions compile #421
Comments
I think that, ideally, the stub solution would compile and fail at the first test, but some problems have incomplete stub solutions (maybe because implementing a data type is part of the exercise), and cannot compile. We could try to fix those exercises using incomplete data types, but I'm not sure if that's possible in all cases. What we are facing in this issue is a fundamental incompatibility between test-driven development and "statically-typed languages". There is no way to run the tests before everything type-checks. We had a lot of work trying to make test suites that accept multiple types to mitigate the fact that, in Haskell, the types usually come before writing the tests. If we can "fix" each exercise to compile without ruining the challenge, then I think it would be great to test the stub solutions in Travis. |
One way to improve in this direction is to first move all exercises to the new proposed format. Removing the examples from the |
All right, now that the examples are moved out of the way, let's try to think about how checking all stubs might be done. We'll take The stub solution gives: module Allergies (Allergen(..), allergies, isAllergicTo) where
allergies :: Int -> [Allergen]
allergies = undefined
isAllergicTo :: Allergen -> Int -> Bool
isAllergicTo = undefined And the problem is simply that So what can we do about this?
|
Except for the first alternative, all the other introduce complexity and maintenance, which I think is against your original goal of this PR. The biggest problem with the first option is that it doesn't work for all exercises. But we can change the exercises ❗ 46/74 exercises fail when built with Here is the list of the problematic ones:
Edit: Five of the above exercises compile the stub, but do not compile the test suite. It would be desirable to check that the test suite can be compiled too, because this proves that the stub solution is somehow correct and can be used by the students. The cause of our headache here is that some test suite depends on the data structures. Maybe it was not a good design choice in the fist place to expose data structures to the test suite, because this usually hinders improvements in design. Functions that return a custom data type are OK. Even when it is expected that the data type has some instances needed by the test suite. What is problematic is exposing data constructors. Before accepting that we need stubs that don't compile, I would like to spend some time rewriting the inconvenient exercises to see if it is worthy to allow stubs that don't build. |
It's always bad to induce a kind of solution, but having a stub solution that doesn't compile is also annoying. Hummm...If the student is able to use We can explain that in the |
Oh! Sorry @petertseng. I didn't saw that you had already made the list of stubs that cannot build in a previous commit. I added more 5 that can build but cannot build the test suite. |
It is partially my fault since I edited it into my comment, so it wouldn't have gotten emailed (I am saying this with the assumption that you read the email first, but I only assume that because.. that's what I do!) That's why sometimes if I want to edit, I will first make it a separate comment, then edit, then delete the separate comment, so that my edit does get emailed. |
Smart trick. Nice to know that! 😄 |
In #412 I made a type change to the tests + example solution but forgot to change the stub solution.
In #420 we discuss that we should keep packages in
package.yaml
if the stub solution needs them.It would be good if we had a way to automatically check this. I think this means we should probably check that the stub solution compiles in Travis.
Are there any stub solutions that we expect not to compile? any other concerns with this approach? (It will increase the time taken, probably, but perhaps it is worth it. We will see when we do it)
The text was updated successfully, but these errors were encountered: