-
Notifications
You must be signed in to change notification settings - Fork 5
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
How do you traverse a directory (for example)? #2
Comments
I've been bitten by this as well. What I think you want is The next layer up would then be to have the continuation function build a |
Would the following function be a suitable solution?
To support recursive traversals, |
I have uploaded a small helper package to Hackage called streaming-bracketed which I believe can help with the directory traversal problem. For example, here's a function (taken from the testsuite) that performs directory traversal:
A value of type
|
Given that this library is all about using the "with idiom", the lack of an actual bracket function that works with
Stream
makes you wonder how you should use all this. From what I could gather by looking at the issue trackers, there wereMonadResource
andMonadMask
instances in the past, but they have been removed. Since the documentation is not up-to-date everywhere, I have no idea how to proceed.For instance, this is how I got a simple directory traversal to work. Trigger warning.
This is obviously not how to do it. But since there is no
MonadMask
instance, the types of both the vanillabracket
function, and the one fromexceptions
, are kind of "in the way".Should I reconsider the type of this kind of function? Does this functionality already exist? Did I miss some important piece of documentation?
The text was updated successfully, but these errors were encountered: