You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we don't provide it, the stub solution doesn't compile with the tests.
If we don't provide it, the student has to read the test file, find all the possible constructors, and make the data type exactly as we want it anyway.
So, I argued to provide it to the student.
We can see that this is distinct from the case where the test demands an abstract type (such as a Robot) and wishes to perform some operations on it. In this case:
the test doesn't care about the implementation of the type
the student can choose the representation
therefore we make a data Robot = Dummy in the stub file
In this issue I'll discuss a few exercises of the first type:
allergies: Allergen
meetup: Weekday and Schedule
space-age: Planet
So, should we give these three exercises the same treatment, and fully define the above-mentioned data types, with constructors?
(If doing so, we can remove the .meta/DONT-TEST-STUB file for each of these exercises)
The text was updated successfully, but these errors were encountered:
I think that this is the way to go. We have to sacrifice a little flexibility in designing exercises, but we gain a more coherent user-experience and automatic testing of stubs. 👍
Clock is the last remaining exercise that has the .meta/DONT-TEST-STUB
file because the type in the src/Clock.hs stub is not compatible with
the test suite.
Other examples of exercises that were revised so that testing the stub
became possible are listed in #466. The difference is that those all had
`data` definitions, whereas Clock is ideally solved with a 'newtype' and
an appropriate alias.
The DONT-TEST-STUB mechanism was added by @petertseng in #464 and in
particular the commits
- 1d91ceb (Travis code)
- 342b932 (Clock-specific)
The change made in this commit argues that since the example solution
has `deriving Eq`, adding this to the stub *will* make the exercise a
bit easier, but it still won't give away the central piece.
The motivation behind removing DONT-TEST-STUB in Clock is that with this
single effort, we can say that all stubs can be compiled and tested. To
motivate further, I will cite @rbasso in #466:
> I think that this is the way to go. We have to sacrifice a little
> flexibility in designing exercises, but we gain a more coherent
> user-experience and automatic testing of stubs. 👍
This bumps the exercise's version from 2.4.0.9 to 2.4.0.10.
See in #464 (comment) how I argued:
data
type exactly as we want it anyway.So, I argued to provide it to the student.
We can see that this is distinct from the case where the test demands an abstract type (such as a
Robot
) and wishes to perform some operations on it. In this case:data Robot = Dummy
in the stub fileIn this issue I'll discuss a few exercises of the first type:
Allergen
Weekday
andSchedule
Planet
So, should we give these three exercises the same treatment, and fully define the above-mentioned
data
types, with constructors?(If doing so, we can remove the
.meta/DONT-TEST-STUB
file for each of these exercises)The text was updated successfully, but these errors were encountered: