haskell / haskell/filepath

Add function to get root directory

Open
#66 8 comments 1 reaction 0 assignees View on GitHub
discussion
Dominant language
Haskell
Stars
74
Forks
38
PR merge metrics
No merged PRs in 30d

Description

Is there really no function to get the root directory? 😳

```hs
rootDirectory :: FilePath -> FilePat

rootDirectory "/directory/other.ext" == "/"
rootDirectory "directory/other.ext" == "directory"
rootDirectory "/foo/bar/baz" == "/"
rootDirectory "foo/bar/baz" == "foo"
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the filepath package's existing path decomposition API and its tests, then compare the proposed rootDirectory behavior with the four examples in the issue. Done means the new function has a clear FilePath signature and its behavior matches those examples for absolute and relative paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
backend-api-design
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.