Skip to content

Disconnect result equality testing from Eq instance. #12

@vlstill

Description

@vlstill

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.

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions