Skip to content

resolve: make signature reflect impurity #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
"gulpfile.js",
"package.json"
],
"dependencies": {
"purescript-eff": "^0.1.1"
},
"devDependencies": {
"purescript-assert": "^0.1.0"
}
Expand Down
6 changes: 3 additions & 3 deletions src/Node/Path.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ exports.concat = function (segments) {
return path.join.apply(this, segments);
};

exports.resolve = function (from) {
return function (to) {
return path.resolve.apply(this, from.concat([to]));
exports.resolve = function (paths) {
return function () {
return path.resolve.apply(this, paths);
};
};

Expand Down
4 changes: 3 additions & 1 deletion src/Node/Path.purs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module Node.Path where

import Control.Monad.Eff

-- | Type for strings representing file paths.
type FilePath = String

Expand All @@ -12,7 +14,7 @@ foreign import normalize :: FilePath -> FilePath
foreign import concat :: Array FilePath -> FilePath

-- | Resolves `to` to an absolute path ([from...], to).
foreign import resolve :: Array FilePath -> FilePath -> FilePath
foreign import resolve :: forall eff. Array FilePath -> Eff eff FilePath

-- | Solve the relative path from `from` to `to`.
foreign import relative :: FilePath -> FilePath -> FilePath
Expand Down
3 changes: 3 additions & 0 deletions test/Test/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ main = do
assert $ extname "index" == ""
assert $ sep == normalize "/"
assert $ delimiter == ";" || delimiter == ":"
path1 <- resolve []
path2 <- resolve ["."]
assert $ path1 == path2