haskell / haskell/filepath

A type for filepath components

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

Description

While working on https://github.com/commercialhaskell/path/pull/192 I noted that it might be helpful to have a separate type for a path component for some use cases. Since we have the nice AFPP-style APIs that is nothing more than a slice of the underlying filepath:
```haskell
module System.OsPath.Component where

-- | A component of a filepath, i.e. a filpath that does not contain any path separators.
newtype Component = Component (SliceOf OsPath)

-- This should probably live in the os-string package
data SliceOf = SliceOf
{ sliceOfOffset :: {-# UNPACK #-} Int -- ^ The offset where the slice starts in bytes
, sliceOfLength :: {-# UNPACK #-} Int -- ^ The length of the slice in bytes
, sliceOfFilePath :: {-# UNPACK #-} OsPath -- ^ The underlying filepath
}
```
As far as I am concerned I am only interested in an addition for the AFPP-style filepaths.

Would the contribution of such a type and the API for working with it accepted?
Is a CLC proposal needed?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.