Skip to content
New issue

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

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

Already on GitHub? # to your account

makeRelative: document the laws #169

Open
hasufell opened this issue Oct 10, 2022 · 1 comment
Open

makeRelative: document the laws #169

hasufell opened this issue Oct 10, 2022 · 1 comment

Comments

@hasufell
Copy link
Member

In GitLab by @abel on Oct 10, 2022, 20:58

See https://hackage.haskell.org/package/filepath-1.4.100.0/docs/System-FilePath.html#v:makeRelative .
I would intuitively have expected makeRelative to be a partial inverse to </>, so that the following law holds:

  (makeRelative root path == Just rest)  ==  (root </> rest == path)

However, the actual function is total and we have makeRelative root path = path whenever we should actually get makeRelative root path = Nothing. But also, we have e.g. makeRelative "." path = path.

So, what would actually the laws be that specify makeRelative? And, could they please be added to the documentation?

@hasufell
Copy link
Member Author

In GitLab by @maerwald on Oct 10, 2022, 21:28

We document the behavior via doctests. It allows unit test cases and properties. So feel free to augment it with your examples. Then run make to regenerate the tests.

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

No branches or pull requests

1 participant