Skip to content

Reorganising node-fs and node-fs-aff #19

@hdgarrood

Description

@hdgarrood

/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' fs module. However, it has some high-level features, eg Perms, Encoding.
  • node-fs-aff is a higher-level library than node-fs, but only in one way as far as I can tell (i.e. it uses aff)
  • 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 = String has 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?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    purs-0.15A reminder to address this issue or merge this PR before we release PureScript v0.15.0type: breaking changeA change that requires a major version bump.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions