question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

proposal: remove laws directory from repository

See original GitHub issue

Earlier today I created #170 and #172, but I now realize that many of the property tests are dysfunctional. To provide one more example, the test for semigroup associativity seeks to assert:

(a `concat` b) `concat` c = a `concat` (b `concat` c)

Since it uses the same value for a, b, and c, it actually asserts:

(a `concat` a) `concat` a = a `concat` (a `concat` a)

If a is Identity('x') and both sides evaluate to Identity('xxx'), we haven’t proven the fantasy-land/concat method of our Identity type to be associative, have we?

The functions provided in fantasy-land/laws are not very useful. To actually test many of these properties we can’t use a universally applicable function such as identity :: a -> a. Instead, we must use functions specialized to the data types being tested. Choosing these functions requires a great deal of care, and this is the thing which makes testing these properties challenging, not copying a line from the spec and adding the fantasy-land/ prefixes where appropriate.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:15 (15 by maintainers)

github_iconTop GitHub Comments

2reactions
davidchamberscommented, Nov 13, 2016

I’m in favour of moving the laws to a separate repository to allow releases for the two projects to be made independently. Currently we’re in an awkward position because we can’t really follow SemVer for the laws without confusing those who only use the spec.

2reactions
SimonRichardsoncommented, Sep 21, 2016

The idea for the laws was to provide the laws in a easy to reference function setup, so you didn’t have to keep remembering what they are. This also prevents the issue of subtle bugs, which is how we’ve ended up in the left/right identity issue.

I like the lhs, rhs setup as well as it eradicates the equality issue (not everything can be equal as some structures are lazy and require executing in certain ways), by putting that on the implementer.

Something like (just an idea):

const {lhs, rhs} = require('fantasy-land/laws/semigroup').associativity;
return equals(lhs(a,b,c), rhs(a,b,c))
Read more comments on GitHub >

github_iconTop Results From Across the Web

Delete directory from the web | GitHub Changelog
Browse to the directory in the repository and branch that you want to delete. In the top-right corner, click "…", and then Delete...
Read more >
How to remove a folder from a repository in github?
Browse to the directory in the repository and branch that you want to delete. In the top-right corner, click " … ", and...
Read more >
Deleting files in a repository - GitHub Docs
Browse to the directory in your repository that you want to delete. · In the top-right corner, click , then click Delete directory....
Read more >
Good Guidance Practices - Regulations.gov
Summary of Proposed Good Guidance Practices Regulations ... HHS proposes to define “guidance repository” to mean an online electronic ...
Read more >
File Locking - GitLab Docs
To view and remove file locks: On the top bar, select Main menu > Projects and find your project. On the left sidebar,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found