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

Generalized lifting/unlifting effect #306

Merged
merged 102 commits into from
Oct 28, 2019
Merged

Conversation

robrix
Copy link
Contributor

@robrix robrix commented Oct 26, 2019

This PR explores using the facilities introduced in #296 to unlift monads. (Edit: The dependency on #296’s features is no longer present.)

  • Depends on 🔥 Pure & PureC #307.
  • Defines an Unlift effect and carrier. Improves the definition of Lift to support unlifting.
  • 🔥s the MonadUnliftIO instances & dependency on unliftio-core.
  • Control.Effect.Exception should probably live in fused-effects-exceptions instead.
  • Tests for Lift/LiftC.

@robrix robrix changed the title Experiment: Unlift effect Experiment: Generalized MonadBaseControl effect Oct 27, 2019
@robrix robrix changed the title Experiment: Generalized MonadBaseControl effect Experiment: Generalized lifting/unlifting effect Oct 27, 2019
@robrix robrix requested a review from patrickt October 27, 2019 13:32
@robrix robrix changed the title Experiment: Generalized lifting/unlifting effect Generalized lifting/unlifting effect Oct 27, 2019
@robrix robrix mentioned this pull request Oct 27, 2019
4 tasks
@robrix robrix changed the base branch from lift-identity-subsumes-pure to master October 28, 2019 01:00
@KingoftheHomeless
Copy link

KingoftheHomeless commented Oct 28, 2019

This is the corresponding effect to polysemy's Final effect. You may like to look into the Strategic environment which we provide for making it easier to use the effect. (Currently in the process of being reworked over at polysemy: polysemy-research/polysemy#239)

Copy link
Collaborator

@patrickt patrickt 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 really, really mindblowing. I love this, and I think it's a real leap forward for the expressivity of our library. (Consider how nice this would be atop STM.)

I have thoughts (below), but I'm 100% in favor of this. Great stuff.

ChangeLog.md Outdated Show resolved Hide resolved
ChangeLog.md Outdated Show resolved Hide resolved
fused-effects.cabal Show resolved Hide resolved
src/Control/Effect/Lift.hs Outdated Show resolved Hide resolved
@KingoftheHomeless
Copy link

KingoftheHomeless commented Oct 28, 2019

In polysemy we chose to separate Final (this new Lift) from Embed (your old Lift) because Final is invariant in the parametrized monad, while Embed is covariant in the parametrized monad.
Embed is thus more flexible to interpret, which can seen in the differences between runEmbedded and finalToFinal.

@robrix
Copy link
Contributor Author

robrix commented Oct 28, 2019

@KingoftheHomeless thanks for the comparison!

@patrickt patrickt merged commit 2665fd2 into master Oct 28, 2019
@robrix robrix deleted the empty,-the-opposite-of-full branch October 28, 2019 19:58
@ilyakooo0
Copy link

ilyakooo0 commented Dec 1, 2019

Could you give an example of how to implement MonadUnliftIO for a custom carrier with liftWith?

Or just provide an example of the general use case for how the new Lift replaces the need for MonadUnliftIO instances.

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

4 participants