editorial note: This was originally a post in the HF Technical Agenda discussion.
The matter of the amending or adding to the base
library has come up a fair amount in the HF Technical Agenda discussion. While such changes are of course possible, I do wonder whether this is the best solution to the problems that users feel. Afterall:
- changing
base
comes at a high cost to existing users - adding to
base
comes at a high cost with respect to maintenance and entrenches design decisions (e.g. mergingcontainers
orvector
intobase
would introduce significant technical challenges) -
base
is coupled to a particular GHC version, meaning that users need to upgrade both the compiler and codebase simultaneously, resulting in unnecessarily painful upgrades - users’ needs vary:
base
can never and will never be the right library for all users.
This makes me wonder whether an HF-blessed alternative prelude isn’t a better approach. That is, develop and promote a base
alternative which:
- closely follows the structure of
base
(where appropriate) and is relatively conservative with introducing its own abstractions - does away with partial functions and known laziness foot-guns (e.g.
foldl
) - re-exports the libraries that nearly every Haskell program uses (e.g.
containers
,text
,bytestring
,deepseq
, etc.)
Of course, I’m almost positive that such a library is available on Hackage today. However, currently alternative prelude usage is pretty rare. I would like to understand why this is the case. A number of possible reasons come to mind:
- reluctance on the part of users to deviate from what comes with the compiler
- concerns about continued maintenance (or lack thereof) of alternative preludes on Hackage
- limited benefit due to the restrictions on what a prelude can change (e.g. the typeclasses of
base
are essentially set in stone, unless the alternative prelude is willing to provide many instances of its own)
My sense is that with proper support from the HF and careful design such a library could supplant base
as the natural starting-point for new Haskell projects Moreover, such a library could be versioned and changed independently from GHC, reducing the burden of core library evolution on the rest of the ecosystem. Of course, similar ideas have been floated many times in the past so I would very much like to hear real users’ reasons on why they might shy away from such alternative preludes.
Have you considered using an alternative prelude in the past? Did you end up doing so? If not, why?