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

Add bindings to bytestring package #151

Merged
merged 15 commits into from
Sep 10, 2023

Conversation

mmhat
Copy link
Contributor

@mmhat mmhat commented Apr 5, 2023

This PR tries to fill a gap in the current effectful package: We provide bindings to System.IO and UnliftIO.IO.File which allow us to get a handle for a file or write a file, but we do not provide the necessary operations to actually read from/write to the handles or read the contents of a file without using IOE. These missing operations are provided here together with lifted versions of other IO related functions from the bytestring package which were added for the sake of completeness.

The PR also adds a new Console effect (as mentioned here) that signals stdin/stdout/stderr usage and is used by the Effectful.ByteString modules. It may not be suitable for larger applications but IMHO it is valuable for smaller ones or prototyping where there is no need for a solution like streaming library or a logging framework.

Copy link
Collaborator

@arybczak arybczak left a comment

Choose a reason for hiding this comment

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

Thanks 👍

effectful/effectful.cabal Outdated Show resolved Hide resolved
effectful/src/Effectful/Console/Static.hs Outdated Show resolved Hide resolved
effectful/effectful.cabal Outdated Show resolved Hide resolved
effectful/effectful.cabal Outdated Show resolved Hide resolved
effectful/src/Effectful/Console/Static.hs Outdated Show resolved Hide resolved
effectful/src/Effectful/Console/Static.hs Outdated Show resolved Hide resolved
effectful/src/Effectful/Console/Static.hs Outdated Show resolved Hide resolved
@arybczak
Copy link
Collaborator

Let's add all functions from https://hackage.haskell.org/package/bytestring-0.11.4.0/docs/Data-ByteString-Char8.html#g:29 (and corresponding for lazy version) to Effectful.Console.ByteString{,Lazy} for completion.

Same with https://hackage.haskell.org/package/bytestring-0.11.4.0/docs/Data-ByteString-Char8.html#g:31 and corresponding for lazy versions, you excluded a few functions and I'm not sure why.

@ocharles
Copy link

What's the status of this? Is it still #151 (comment)? @mmhat I'd be happy to help if you need it!

@arybczak
Copy link
Collaborator

@ocharles feel free to open a separate PR based on this one with missing functions if you need this in now-ish.

@mmhat
Copy link
Contributor Author

mmhat commented May 24, 2023

@ocharles I plan to continue working on it eventually but unfortunately I don't have time to finish this PR right now. So feel free to continue working on it. Yes, the parts mentioned in #151 (comment) are the only remaining issues.

@ocharles
Copy link

Cool, thanks both! I have no burning need for this, but now that we've ported CircuitHub to use effectful I'm generally keeping my eyes out for places where I can swap IOE out for something more specific 😄

@arybczak
Copy link
Collaborator

arybczak commented Aug 3, 2023

@mmhat ping. I'd like to include this in 2.3.0.0 which will be released soon.

@mmhat
Copy link
Contributor Author

mmhat commented Aug 15, 2023

@arybczak I'll finish it during the upcoming weekend.

@mmhat
Copy link
Contributor Author

mmhat commented Aug 17, 2023

@arybczak I addressed the issue with the missing functions pointed out in #151 (comment). Please let me know if something else is missing or needs to be changed and I'll try to resolve that quickly this time.

@mmhat
Copy link
Contributor Author

mmhat commented Sep 10, 2023

@arybczak I added version bounds for tasty-bench and disabled benchmarks on GHC<9.8. I had to do this to get a green CI; If we want to restore the previous behavior I suggest to do that in a separate PR.

@arybczak
Copy link
Collaborator

Thanks 🙂

@arybczak arybczak merged commit 8b1b4a8 into haskell-effectful:master Sep 10, 2023
7 checks passed
@mmhat mmhat deleted the bytestring-bindings branch September 11, 2023 11:31
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.

3 participants