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
The testing expression is basically of form \x y … -> student x y … == teacher x y … that is it uses (==) for equality testing, this works well unless students are tempted to create their own instances of Eq for result data type, which can happend if it is a custom data type and Eq instance is not pre-declared in the testing enrionment (more precisely, the declaration is not advertised to students).
We don't want to disallow students to define Eq instances if they are not advertised in the assignment, but sometimes we don't want to provide it to them. Since we don't want to risk using student-provided Eq instance (as could be caused by late deriving, see #10), and instance export can not be disabled, we have to replace equality testing using Eq with custom one, possibily something like:
class TestEquality a where
eq :: a -> a -> Bool
And then having test of form \x y … -> student x y … eq teacher x y …. We would then need to derive instances of TestEquality probably using TemplateHaskell or generics, with possibility to override this instance.
The text was updated successfully, but these errors were encountered:
The testing expression is basically of form
\x y … -> student x y … == teacher x y …
that is it uses(==)
for equality testing, this works well unless students are tempted to create their own instances ofEq
for result data type, which can happend if it is a custom data type andEq
instance is not pre-declared in the testing enrionment (more precisely, the declaration is not advertised to students).We don't want to disallow students to define
Eq
instances if they are not advertised in the assignment, but sometimes we don't want to provide it to them. Since we don't want to risk using student-providedEq
instance (as could be caused by late deriving, see #10), and instance export can not be disabled, we have to replace equality testing usingEq
with custom one, possibily something like:And then having test of form
\x y … -> student x y …
eqteacher x y …
. We would then need to derive instances ofTestEquality
probably using TemplateHaskell or generics, with possibility to override this instance.The text was updated successfully, but these errors were encountered: