Skip to content
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

Disconnect result equality testing from Eq instance. #12

Open
vlstill opened this issue Nov 11, 2015 · 0 comments
Open

Disconnect result equality testing from Eq instance. #12

vlstill opened this issue Nov 11, 2015 · 0 comments
Assignees
Milestone

Comments

@vlstill
Copy link
Owner

vlstill commented Nov 11, 2015

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.

@vlstill vlstill added this to the 3.0 milestone Jun 1, 2018
@vlstill vlstill self-assigned this Jun 1, 2018
@vlstill vlstill modified the milestones: 3.0, 4.0 Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant