Refactoring proposal on Library name
- 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
Assessment
This issue has not been assessed yet.