-
Notifications
You must be signed in to change notification settings - Fork 33
Description
/cc @felixSchl
I think the current situation with purescript-node-fs and purescript-node-fs-aff is less than ideal. Some thoughts:
node-fs, in many ways, is a low-level FFI binding to Node.js'fsmodule. However, it has some high-level features, egPerms,Encoding.node-fs-affis a higher-level library thannode-fs, but only in one way as far as I can tell (i.e. it usesaff)- This is a weird mixture of high-level and low-level things which creates unnecessary work for us.
- We should have one place for high-level filesystem things, and one place for low-level filesystem things.
type FilePath = Stringhas no place in a high-level filesystem library. In a high-level filesystem library, we should be using something like purescript-pathy for paths.
I propose that we merge both of these into one library (purescript-filesystem?) with separate high-level and low-level parts. The low-level parts should closely mirror node's fs module, use String for everything, and return Eff actions, while the high-level parts should be designed first and foremost in a way that makes sense and is easy to use, should use proper types like Perms, Encoding, and Path, and return Aff actions.
If there's a need for it, we can break out the low-level parts into a separate library.
It also might be a good time to think about how to deal with other backends. Preferably the high-level library would be able to support backends other than node.js. (Perhaps free monads would be a good fit for enabling this?)