Description
Languages like python provide really fast and simple ways to perform most operations, which lends itself very well to scripting.
I think that Scala fails at this, while it's better than Java it's still not great. I don't think this is a problem for most situations.
I do however think it would be very nice if toolkit could provide default implementations of some common tasks in a referential transparent and resource-safe way. An example would be reading and writing files.
I'm pretty new to using CE so I ended up writing this, which I'm not even sure is the correct way to do this.
def fileWriter(path: String): Resource[IO, FileWriter] =
Resource.make(IO.blocking(new FileWriter(new File(name))))(file => IO.blocking(file.close()))
def openFile(path: String) : Resource[IO, Source] =
Resource.make(IO.blocking(Source.fromFile(path)))(file => IO.blocking(file.close()))
def writeToFile(path: String, content: String) =
fileWriter(path).use(writer => IO.blocking(writer.write(content)))
if instead similar operations were already implemented for me I think that would be really great. It would at least make it a lot easier to convince other people to use this :)
All of this might obviously be outside of the scope of toolkit as it's a collection of libraries, but it would certainly make it easier to pick up for people who just want something to write small tools with.
Activity