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

Use / as pathSeparator also on Windows #170

Open
hasufell opened this issue Dec 8, 2022 · 2 comments
Open

Use / as pathSeparator also on Windows #170

hasufell opened this issue Dec 8, 2022 · 2 comments

Comments

@hasufell
Copy link
Member

hasufell commented Dec 8, 2022

In GitLab by @andreasabel on Dec 8, 2022, 17:06

Windows supports / as path separator. (Apparently, since forever, which I didn't know, but this discussion even says DOS already accepted it: https://bytes.com/topic/python/answers/23123-when-did-windows-start-accepting-forward-slash-path-separator.)

Making pathSeparator uniformly '/' would increase the portability of Haskell CLI programs to Windows.
I think differentiating needlessly between OSs here is a hindrance to portability rather than an enabler of portability.

Here are examples where e.g. golden value testsuites break on Windows because of that non-uniformity of path separators:

Switching pathSeparator would of course be a major backwards-incompatibility, so there should be maybe a major-major version bump to 2.x.
(If this issue is accepted, one could think about migration routes.)

@hasufell
Copy link
Member Author

Switching pathSeparator would of course be a major backwards-incompatibility, so there should be maybe a major-major

/ is for compatibility. I'm not sure it's a good idea to make it the default. The potential breakage is almost impossible to foresee. Yes, the syscalls accept both variants, but user code may rely on the current behavior when dealing with internally constructed filepaths.

If you have golden tests, you can create different golden files per platform, e.g.: https://github.com/haskell/ghcup-hs/blob/823458910b41cf79739257dbc3d08084400bb594/test/GHCup/Types/JSONSpec.hs#L15-L21

@hasufell
Copy link
Member Author

@andreasabel

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