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

remove modules for verifying laws #284

Merged
merged 1 commit into from Jun 16, 2018

Conversation

davidchambers
Copy link
Member

Closes #174

Commit message:

There is now a separate package, fantasy-laws, which serves this role.

Copy link
Contributor

@Avaq Avaq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! Let's wait for more opinions though.

@gabejohnson
Copy link
Member

Why are you moving Id but removing Compose and Sum? I'm assuming it's because Id is included as an example demonstrating how one might go about implementing the specification while Compose and Sum are only provided for use in the tests.

If this is the case, I would move equality and lte into id.js and remove the dependency on sanctuary-type-classes (which incidentally isn't included in package.json).

@davidchambers
Copy link
Member Author

I'm assuming it's because Id is included as an example demonstrating how one might go about implementing the specification while Compose and Sum are only provided for use in the tests.

That was my thinking, yes. We could go one step further by removing the Id implementation and linking to sanctuary-identity as soon as sanctuary-js/sanctuary-identity#3 is merged (this pull request could remain open until then).

If this is the case, I would move equality and lte into id.js and remove the dependency on sanctuary-type-classes (which incidentally isn't included in package.json).

In order for Id#fantasy-land/equals to have value-based semantics one must do one of two things:

  • use Z.equals in the implementation; or
  • in addition to dispatching to fantasy-land/equals, provide suitable definitions for built-in types:
    • Null#fantasy-land/equals;
    • Undefined#fantasy-land/equals;
    • Boolean#fantasy-land/equals;
    • Number#fantasy-land/equals;
    • Date#fantasy-land/equals;
    • RegExp#fantasy-land/equals;
    • String#fantasy-land/equals;
    • Array#fantasy-land/equals;
    • Arguments#fantasy-land/equals;
    • Error#fantasy-land/equals;
    • Object#fantasy-land/equals; and
    • Function#fantasy-land/equals.

The file will better serve its pedagogical role if Z.equals is used in the implementation of Id#fantasy-land/equals, as this is the approach we would like ADT authors to adopt. Better yet would be to link to a complete working implementation (once it is available).

There is now a separate package, fantasy-laws, which serves this role.
@davidchambers davidchambers merged commit b6f2b80 into fantasyland:master Jun 16, 2018
@davidchambers davidchambers deleted the no-laws branch June 16, 2018 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants