File path of an Elm (or other) file.
Converts from module name to its expected file path.
Additionally needs the source directory from elm.json.
The source directory can be passed both with and without the trailing slash.
expectedFilePath { sourceDirectory = "src", moduleName = "Foo" }
--> "src/Foo.elm"
expectedFilePath { sourceDirectory = "src/", filePath = "Foo" }
--> "src/Foo.elm"Normalize the file path.
removeTrailingSlash "src/foo/"
--> "src/foo"
removeTrailingSlash "src/foo"
--> "src/foo"
removeTrailingSlash "src/foo/Main.elm"
--> "src/foo/Main.elm"
Just a
Stringalias, instead of atypewrapper. We generally use records with explanatory field names where two Strings would be next to each other, to protect against swapping them accidentally.