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

Consider using a typed path library #4277

Open
Tracked by #4364
michaelpj opened this issue Jun 4, 2024 · 2 comments
Open
Tracked by #4364

Consider using a typed path library #4277

michaelpj opened this issue Jun 4, 2024 · 2 comments
Labels
Hackathon This issue is suitable for hackathon sessions type: enhancement New feature or request

Comments

@michaelpj
Copy link
Collaborator

Is your enhancement request related to a problem? Please describe.

Making paths absolute can be a bit tricky for us, since it's somewhat unclear where HLS is supposed to be running, and hence what relative paths are supposed to be relative to.

But at the moment we don't even really know the scope of the problem. Hopefully, most of the time we are dealing with absolute paths, but we have various random places where we make things absolute. It would make things a lot clearer if this was tracked in the types.

Describe the solution you'd like

Use one of the typed path libraries for file paths. We might also need to adjust our NormalizedFilePath and NormalizedUri types to track whether they are relative or absolute, but ideally we would use the same mechanics there as whatever typed path library we use.

Describe alternatives you've considered

Roll our own typed path library. This might be worth it if it's not much code.

@michaelpj michaelpj added type: enhancement New feature or request Hackathon This issue is suitable for hackathon sessions labels Jun 4, 2024
@michaelpj
Copy link
Collaborator Author

We could also track other information in the types, e.g. "is it a Haskell or Cabal file" or "is it a project or non-project file".

@komikat
Copy link
Contributor

komikat commented Jul 15, 2024

path supports distinguishing between absolute/relative paths in the types themselves. I think I'll be starting by replacing FilePath with Path wherever possible.

Edit: hand rolling a typed path library seems better due to a much narrower use-case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hackathon This issue is suitable for hackathon sessions type: enhancement New feature or request
Projects
Development

No branches or pull requests

2 participants