ZHaskell / stdio

Haskell Standard Input and Output
104 stars 5 forks source link

Basic filesystem operations #4

Closed ABorgna closed 6 years ago

ABorgna commented 6 years ago

Adds a minimal set of operations to System.IO.FileSystem. Just open, write, read, and readT (threaded version).

I wanted an non-trivial operation from where I could get an UVSlot so I added these based on the functions already present in hs_uv.c. I hope it is not too far away from the design you had in mind, just tell me what should be changed.

winterland1989 commented 6 years ago

Thank you for putting all these together! I'm very glad to merge your contributions, the final file API may changed drastically though:

Another thing I'm recently planning is to change the Output class to support overlapped write, i.e. user should be able to use separate request struct in different write without affect each other, this idea is being worked on and still need some API tweak. But i think the most of the code from this patch is useful. Thanks again!

ABorgna commented 6 years ago

Great! I had to bump the libuv version used in Travis from v1.8.0 to v1.11.0 for it to work. Otherwise it threw undefined references to uv_translate_sys_error and uv__io_start while linking.