-
Notifications
You must be signed in to change notification settings - Fork 4
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
Discussion: Simplify the API for newcomers #77
Conversation
Deleted the `readStream` method Squashed the `readWithCharset` method with `read`
Formatted sources and deleted unused imports
The simplification looks good, but I think you can do further, for example: -def list(path: Path): Stream[IO, Path] = files.list(path)
+def list(path: Path): IO[List[Path]] = files.list(path).compile.toList
- def open(path: Path, flags: Flags): Resource[IO, FileHandle[IO]] =
- files.open(path, flags)
- def readCursor(path: Path, flags: Flags): Resource[IO, ReadCursor[IO]] =
- files.readCursor(path, flags)
The thing is that I don't think any newcomer will ever use this methods, nor write a codec for something, BUT if we write a short tutorial on "how to implement your own saving format for your application" I might be in favor of keeping it there. It's not the main goal of this library, but we can discuss it. Keep up with the good work. I'm willing to also see the site/doc changes that you're doing. |
The `load` method now returns an `IO[List[Path]]` instead of a `Stream[IO, Path]` The `open` and `readCursor` methods where eliminated as well (not going to be used that often anyways), just as suggested. Co-authored-by: TonioGela <toniogela89@gmail.com>
For EDIT: nvm see it correctly now! |
What have you seen? I'm asking it because I forgot what we decided about it, and forcing users to specify UTF-8 everywhere is a no-go. |
I guess he saw that the |
Okay, but do we have just a single |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a small name-shedding comment, which shouldn't block this pr.
Great works @Hombre-x and everyone!
Now all the tempDirectory and tempFile functions are named withTempDirectory and withTempFile, respectively
Names changed 😀 |
As @TonioGela and @armanbilge suggested, the API is bloated with difficult concepts such as
Resources
or context abstractions.To ensure that newcomers are not hindered in their encounter with these things, some deletion - refactoring - changing of the API was suggested to improve the experience with the library in general.
This PR aims to open a discussion to merge some of these changes and further discuss if some more changes are required to accomplish this goal of enhancing the experience of new users.
What has been done so far:
readStream
function to get rid of theStream
type and concepts.WithCharset
method with their standalone variant (similar to os-lib) style.tempFile
andtempDirectory
to not return aResource
.Whats left to discuss:
The
As
variant of the three standalone methods was unchanged as I think we should talk before If I may get rid only of the typeclass use and instead add the codec as a dependency in the parameters, or, get rid of the methods entirely as well as with its example in the documentation.