haskell / file-io

File IO (read/write/open) for OsPath API
11 stars 4 forks source link

Make openFile exception safe wrt #8 #11

Closed hasufell closed 9 months ago

hasufell commented 11 months ago

@Mistuke @treeowl

Related: https://github.com/hasufell/file-io/issues/8

hasufell commented 10 months ago

ping @treeowl

hasufell commented 9 months ago

@treeowl i want to merge and release it this week. Do you have time to review?

treeowl commented 9 months ago

Is this just a translation of what I did in base? If so, sounds good. I don't have everything paged in, I was out of the country this week, and I have a lot of things I need to do tomorrow, so I don't think I can handle a full scale review.

hasufell commented 9 months ago

Is this just a translation of what I did in base?

Yes, the major relevant parts are:

https://github.com/hasufell/file-io/blob/01c64dfe304d4006a8215fa908ac675a9ac95390/System/File/OsPath.hs#L131-L161

and then readFile, openFile etc. are defined in terms of withOpenFile'.