elm-in-elm / compiler

Elm compiler written in Elm

Home Page:https://elm-in-elm.github.io/compiler/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Path handling in elm-in-elm

harrysarson opened this issue · comments

A compiler needs to read source files and write output files. Practical compilers will also read and write a number of intermediate files, caching build artifacts for incremental compilation reasons.

Elm code cannot interact with the file system; we have to use ports for that. However, the elm code does have to tell the javascript subscribed to the port where to save the file to.

We need to be able to join paths (i.e. add '/' or '' depending on unix/windows), check if files are the same, get the file name from a path, get paths relative to other paths. I think the best way to achieve this is to write an elm-in-elm/path package.

There is already a library we could at least take inspiration from. This package didn't exist back then, when you opened that issue. There is no path joining in that library, and its not targeting windows. These would be stuff to be implemented. I don't see other packages that are implementing this.