Towards a prevalent alternative prelude?

The tricky part here is that base (unfortunately) currently serves a few, largely orthogonal roles:

  1. it serves as the home of GHC’s IO subsystem (the event manager) which is closely tied to GHC’s runtime system (e.g. GHC.Event, GHC.Conc)
  • it serves as the home of several core typeclasses which are closely tied to the compiler (e.g. GHC.Base, GHC.Functor, GHC.Enum, GHC.Generics)
  • it serves as the home for wrappers to GHC primops which could in principle be implemented elsewhere (e.g. Data.IORef)
  • it serves as a “dumping ground” for things that are “foundational” enough that they should be shipped with the compiler, but which otherwise have no particular relation to GHC (e.g. Data.Fixed, Data.Foldable, Data.Tuple, Text.Printf)

In my mind, base really ought to be several different packages. This is even something that has been attempted in the past. However, implementation is sadly non-trivial as due to, among other things, module cycles and orphan instance issues.

4 Likes