Lots of people dislike the standard prelude, for example for its use of String instead of Text. There have been several attempts to make better ones.
As for other preludes, it's hard to say. relude has the best documentation. protolude looks nice, and classy-prelude is used more often than all other preludes (judging by Github's code search), which probably means something. Anyway, it all depends on your coding style and what exactly you're writing. Also, if you're starting a huge project from scratch, you might want to look at foundation, which reinvents a lot of things (even
Text), but claims to do it better.
A prelude by Stephen Diehl. Described here by its author.
- base, mtl, deepseq, async, void, safe (safer functions for lists)
- Some utility functions (
- Rewrites functions/classes that aren't present in earlier versions of base (
- Defines a class for string conversion and generalises functions like
identity(because it's convenient to be able to name variables
Exports more utility functions than other preludes.
The renaming of
Doesn't do anything radical, so you can start using it quickly.
Adds warnings to
undefined(so you can use them but you're constantly warned that they're still present in code).
Excellent documentation: Haddock with
doctest-tested examples, tutorial, migration guide from
Beginner-friendly: doesn't require advanced Haskell knowledge to use it, but takes advantage of intermediate Haskell features to provide excellent performance and descriptive error messages.
Efficient strings: focuses on using functions with more efficient string types like
Opt in oriented: contains various extremely useful functions. But they are not exported by default to not spoil global namespace.
Custom HLint rules: has custom
hlintrules that allow you to improve code quality after migration to
undefinedas deprecated (so you'll know if you've accidentally left it in code).
Goes further than other preludes in removing boilerplate like qualified names, etc.
Not actually an alternative Prelude, but rather a convenient way to define your own Prelude. It re-exports all of base except for
GHC will implicitly import the module called
Prelude, which is usually found in the
base package. If, however, you depend on base-noprelude rather than base and your package has a module called
Prelude, that will be used instead, allowing you to customise it to your needs.
Assemble your own custom prelude that perfectly fits your needs.
No imports or
NoImplicitPreludepragmas at use sites.
Designed to work out of the box with alternative
Prelude packages such as Prelude.
Could be combined with one of the actual alternative preludes with a dummy
Prelude.hs that uses the qualified module export technique, so that you don't have to import the alt-prelude in every module.
A “foundation” prelude by the author of classy-prelude. Exports two modules –
CorePrelude (intended for developers who want to make their own prelude), and
BasicPrelude (a simple prelude for users, built on
- commonly used functions from
Preludeand other base modules
- types (the usual bunch –
- a selection of functions from other packages (
<.>, as well as hashing functions from hashable, functions for catching exceptions from lifted-base, and
readArgsfrom ReadArgs, a very simple parser for command line arguments)
It also reimplements functions like
Text, and a small number of utility functions (
Control.Monad, methods of
Traversable, some functions from
readFile, etc with their
Text, so can be annoying if you use many libraries that need
Only reimplements a few functions for compatibility with older versions of base (other preludes reimplement more).
Feels somewhat opinionated (why hashable and ReadArgs but not more commonly used libraries like deepseq or mtl? etc).
Foundation is a Haskell project to implement a modern & performant standard library with various centrally maintained functionalities.
Haskell's base has been designed a while ago and shows its age. For better or worse, it's also really hard to change base, leading to many interesting but ultimately fruitless discussions, lots of wasted efforts, and/or duplicated pieces and libraries.
Also many core libraries, which brings lots of welcome modern additions to the language (text, bytestring, vector, & many others), are maintained on the side, without coordination. For example bytestring and vector doesn't share any code.
Foundation is trying to provide a solution to those technical and maintainance limitations.
A single module reexporting most definitions in base. Doesn't serve any purpose other than reducing the number of imports, but is still pretty useful. (For me it routinely shaves off 5–10 imports.)
You don't have to learn any new functions, or, well, anything. Just plug it in and enjoy not having to import things.
Doesn't incur any dependencies.
rebase – uses base-prelude and exports lots of additional modules
A pretty interesting prelude – it depends on lots of commonly used packages (containers, deepseq, hashable, mtl, text, time, uuid, vector, and more), and makes their modules available to you via the
Rebase.* namespace – so, for instance, instead of adding a dependency on text and importing
Data.Text you can just import
Rebase.Data.Text and get
Data.Text.Encoding simultaneously. This means that you save some imports and don't have to manually add a dependency.
Exports modules in full, not just arbitary subsets.
Shaves off more dependency declarations than other libraries.
A superset of base-prelude.
This package provides a "Prelude" module drop-in replacement for base's
Goals of this package include:
- Be reasonably modest and remain close in spirit to the
- Depend only on
base-noprelude) for recent GHC versions
- Avoid partial functions being in scope by default; redefine common partial functions such as
- Provide a uniform "Prelude" across multiple GHC releases (currently GHC 7.0 and newer supported) to the extent possible given typeclass restructurings such as AMP or FTP
importclutter by reexporting common verbs from modules such as
Yet another prelude by Michael Snoyman. From the README:
A Haskell prelude optimized for safety.
No partial functions, period.
Choose best in class libraries (bytestring, text, etc) and promote them.
Regardless of the versions of underlying libraries, this package will always export a consistent API, so that CPP usage should be constrained to just inside this package.
Use generalization (via type classes) when they are well established. For example:
Encourage qualified imports with a consistent naming scheme.
Export any non-conflicting and not-discouraged names from this module that make sense, e.g.
Maintained by company which uses Haskell in production
Reexports a lot of things you usually need in your code (
Textual data type is defaulted to
IOfunctions are lifted to
A lot of commonly used idioms and convenient functions are introduced
Foldabletype hierarchy a little bit reimagined. You might find it unexpected when some things work for
Foldablebut doesn't work anymore when you're using
Assumes medium knowledge of Haskell. It's hard to use
universumfor Haskell beginners, unfortunately.
universum as a custom prelude.
Minimal prelude which fixes pain points (Text, unsafe functions, etc) in the standard prelude.
Good support for Text over String.
Common IO functions are generalized to work in any MonadIO.
Has explicit an export list rather than exporting entire modules. This makes the Haddock documentation so much more useful.
Avoids to export unsafe functions
Multi-package alternative prelude.
papa-base exports the safe and useful things in
papa-bifunctors exports the safe and useful things in
papa itself exports everything from all sub-packages.
From the README:
SubHask is a radical rewrite of the Haskell Prelude. The goal is to make numerical computing in Haskell fun and fast. The main idea is to use a type safe interface for programming in arbitrary subcategories of Hask. For example, the category Vect of linear functions is a subcategory of Hask, and SubHask exploits this fact to give a nice interface for linear algebra. To achieve this goal, almost every class hierarchy is redefined to be more general.