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

Generalize from IO to MonadUnliftIO m => m #17

Merged
merged 2 commits into from
Jun 20, 2020
Merged

Conversation

Fizzixnerd
Copy link
Contributor

This generalizes the monad that Segments run in from IO to MonadUnliftIO m => m. This has many benefits when interacting with the conduit library. For example, it was not possible to use resourcet to handle file resources when outputting to files. With this change, the following code becomes valid:

runResourceT $ run $ do
  ls $| (conduit $ sinkFile "ls.txt")

This is opposed to requiring before to manage the file Handle yourself manually and passing it down, risking closing it too early.

Since redirecting to files is a large part of writing shell scripts, I believe it is worth the cost of 1) breaking the API and 2) slightly increased complexity to integrate this change.

Copy link
Owner

@psibi psibi left a comment

Choose a reason for hiding this comment

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

Sorry, that it took quite a bit of time to review this. The change LGTM apart from one comment.

shell-conduit.cabal Show resolved Hide resolved
@psibi psibi merged commit ef90061 into psibi:master Jun 20, 2020
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

2 participants