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

Interposition is redundant to interpretation #220

Closed
robrix opened this issue Sep 23, 2019 · 1 comment · Fixed by #223
Closed

Interposition is redundant to interpretation #220

robrix opened this issue Sep 23, 2019 · 1 comment · Fixed by #223
Assignees
Labels
bug Something isn't working
Milestone

Comments

@robrix
Copy link
Contributor

robrix commented Sep 23, 2019

InterposeC intercepts requests for an effect without extending the signature; instead, it projects out and handles requests for that effect, passing any others along.

InterpretC and other typical carriers extend the signature at the left, and handle any requests for their signature, passing any others along.

Both extend the monad stack with another layer.

From the perspective of code run inside the monad, it makes no difference whether the available effects are A :+: B :+: C and B is interposed, or B :+: A :+: B :+: C and requests for B are intercepted by the leftmost carrier for B. (It is technically possible to observe the difference since you can constrain the signature and pattern match on the effect sum with a carrier, but there’s no point to doing so and so you simply don’t.)

Therefore, interposition as currently implemented is redundant: you could just have a carrier, either using runInterpret or manually defined, which extends the signature. Doing so would be quite useful since InterposeC is inefficient and complicated, and it would also allow us to remove prj altogether.

@robrix robrix added the bug Something isn't working label Sep 23, 2019
@robrix robrix added this to the 1.0 milestone Sep 23, 2019
@robrix
Copy link
Contributor Author

robrix commented Sep 23, 2019

I propose:

  1. Removing InterposeC, and suggest InterpretC in the changelog.
  2. Removing Project/prj.
  3. Removing the custom interposition tests which are anyways kind of redundant to InterposeC itself.

@robrix robrix self-assigned this Sep 23, 2019
This was referenced Sep 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant