haskell / haskell/filepath

`makeRelative`: document the laws

Open
#169 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
74
Forks
38
PR merge metrics
No merged PRs in 30d

Description

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:
```haskell
(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?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked System.FilePath.makeRelative documentation and examine the stated examples, including makeRelative "." path and the proposed inverse law. Determine and formalize the actual laws that describe its total behavior, then add those laws and clarifying examples to the documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
operating-systems
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.