Skip to content
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

Manipulating foreign file paths #158

Closed
hasufell opened this issue Jun 22, 2022 · 4 comments
Closed

Manipulating foreign file paths #158

hasufell opened this issue Jun 22, 2022 · 4 comments

Comments

@hasufell
Copy link
Member

In GitLab by @Ericson2314 on Jun 22, 2022, 13:33

I not infrequently want to manipulate Windows paths on Unix, and Unix paths on windows; this sort of thing comes up e.g. when planning tasks for a heterogeneous build farm to perform.

filepath has always confused me as to whether this sort of thing is supported. From the way the modules are CPP'd I think the answer is "yes", but the docs in e.g. https://hackage.haskell.org/package/filepath-2.0.0.3/candidate/docs/System-AbstractFilePath-Windows.html still have "On Windows..." "On Unix...." which is very confusing. I think we should CPP the docs to make this clear?

Also, is it good that AbstractFilePath = PosixFilePath on Unix? IMO this is certainly not wrong, but it is a foot-gun. It is akin to saying Int = Int64 on x86_64. Might we consider making AbstractFilePath newtype instead?


Sorry for bringing this stuff up at the 11th hour, but I figure it is much easier to deal with now than post release. We have a limited window to address this and any other would-be breaking change "regrets" from the old way of doing things, but that would require a filepath-3 or AbtractFilePathTake2, neither of which is very appealing!

@hasufell
Copy link
Member Author

In GitLab by @maerwald on Jun 22, 2022, 17:43

I answered your question here: https://gitlab.haskell.org/haskell/filepath/-/issues/116#note_438455

Second part of the answer. So yes, AFPP is designed exactly for this.

@hasufell
Copy link
Member Author

In GitLab by @Ericson2314 on Jun 22, 2022, 23:57

@maerwald Very glad to hear that the newtypes are in place!

Can we add more CPP for the docs then?

@hasufell
Copy link
Member Author

In GitLab by @Ericson2314 on Jun 23, 2022, 24:22

I started a draft MR in https://gitlab.haskell.org/haskell/filepath/-/merge_requests/111 to try to be completely clear about what sort of docs CPP I had in mind. :)

@hasufell
Copy link
Member Author

In GitLab by @Ericson2314 on Aug 29, 2022, 21:21

mentioned in commit ghc/packages/filepath@cca0dc3b6f5ac0aadcc0b26537ebd246eaee042b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant