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

Effect laws are undocumented #142

Closed
robrix opened this issue Mar 28, 2019 · 0 comments · Fixed by #239
Closed

Effect laws are undocumented #142

robrix opened this issue Mar 28, 2019 · 0 comments · Fixed by #239
Labels
bug Something isn't working documentation Communicate to other humans
Milestone

Comments

@robrix
Copy link
Contributor

robrix commented Mar 28, 2019

Effects typically have laws which carriers should observe. e.g., given a Reader effect, sequential asks in the same do-block are expected to return the same value (whereas a carrier for e.g. Reader Int could be implemented to store and increment the value before returning). Unfortunately, these are currently undocumented, which makes it harder to know that your carrier is (in addition to type-checking) correct.

NB: Some of these might be somewhat subtle when considering interactions between effects; e.g. State inside NonDet is maintained per-branch, whereas State outside NonDet is global. This is a feature, in general, since it allows you to select the desired composite semantics by reordering, but it may make it harder to state some of the laws succinctly.

For example, it’s tempting to say that ask >>= \ before -> m >> ask >>= \ after -> pure (before == after) should (observationally) equal pure True for arbitrary m, but if m doesn’t continue (e.g. because it contains a throwError, fail, or empty), that is not strictly true.

@robrix robrix added the bug Something isn't working label Mar 28, 2019
@robrix robrix added this to the 0.6 milestone Sep 1, 2019
@robrix robrix added the documentation Communicate to other humans label Sep 27, 2019
@robrix robrix mentioned this issue Sep 29, 2019
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Communicate to other humans
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant