haskell / haskell/cabal

Refactoring proposal on Library name

Open
#8,567 9 comments 1 reaction 0 assignees View on GitHub
Cabal: Backpack type: discussion type: refactor
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

While trying to move stack [closer to cabal design](https://github.com/commercialhaskell/stack/issues/5920) (to enable backpack in stack in the long term), I stumbled upon this in cabal :
```hs
-- In PackageDescription
library :: Maybe Library
subLibraries :: [Library]
```
And then there is :
```hs
-- in Library
libName :: LibraryName

-- in LibraryName
data LibraryName = LMainLibName
| LSubLibName UnqualComponentName
```

Why don't we statically enforce the Main vs Sub nature of the Library ?
```hs
data LibraryMain = LMain
data LibrarySub = LSub UnqualComponentName

-- and :
library :: Maybe (Library LibraryMain)
subLibraries :: [Library LibrarySub]

-- and :
data Library libType = Library { libName :: libType, etc }
```

It seems like a relatively simple change but I'm still not very familiar with the cabal codebase yet so ... what's your opinion ?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.