I’m considering making NoImplicitPrelude one of the default extensions in my .cabal files.
Yes, I know that means adding all Prelude imports explicitly to the top of the file (as I plan on using -Wmissing-import-lists and -Werror). But, I do that for every other module import, and editor support makes that relatively easy.
Many languages do not have an implicit “prelude”. Admittedly C will give you some basic inbuilt numeric operators for free and some types like int etc) which you don’t get without Prelude in GHC (although interestingly the unit type () you don’t need import) but my point is in C you don’t get a wide range of container and IO operations implicitly like one does with Prelude.
Admittedly various languages take different approaches on how much is “implicitly” imported, some closer to C and some closer to Haskell, but I also feel with Haskell is that the Prelude is a little outdated at this point. It’s very list focused instead of generically handling many structures, has incomplete functions like head and tail, and it’s approach to IO is arguably questionable with things like getContents.
My (IMHO) feeling is that the Prelude was designed for a time where Haskell was used for single file mathematical focused programs in an academic setting, and giving it a elevated status today, at least as a whole, is no longer as appropriate as it may have been in the past.
Of course, there’s many perfectly cromulent things in the Prelude, like Int, Bool, IO, Maybe and the associated functions, as well as type classes like Eq and Ord. Indeed I don’t feel the need to go full replacement Prelude, at least not as a general rule, but polluting the namespace of every file with Prelude seems a bit silly considering that arguably much of it isn’t particularly more special than many functions in other base libraries.
I feel like this decision is just a matter of taste, but I haven’t seen much other Haskell code use NoImplicitPrelude by default. So I just wanted to check this approach with the community, because sometimes when something tastes bad for EVERYONE else it probably means it’s probably poison in someway, and I’d like that to be highlighted if it is.
Note that I do use -Wmissing-import-lists anyway, so it’ll just be an extra line for Prelude imports.