category feedAlternative preludesMiscellaneouseditdelete

This category is a work in progress






Lots of people dislike the standard prelude, so there have been several attempts to make better ones. Or just reexport a bunch of extra modules (to reduce the number of imports needed). Or both.

Recommendations

base-prelude is almost unambiguously a net win because it simply reexports things from base and lets you reduce your imports without making you learn anything new.

As for other preludes, it's hard to say. 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 Vector and Text), but claims to do it better.

edit description
or press Ctrl+Enter to savemarkdown supported
#
protolude (Hackage)
medium
move item up move item down edit item info delete item
Summary edit summary

A prelude by Stephen Diehl. Described here by its author.

Reexports:

  • base, mtl, deepseq, async, void, safe (safer functions for lists)
  • Text/LText, ByteString/LByteString, Map, Set
  • Some utility functions (orAlt, ordNub, whenM, etc)
  • Rewrites functions/classes that aren't present in earlier versions of base (bool, Bifunctor, etc)

Other things:

  • Defines a class for string conversion and generalises functions like show and print
  • Renames id to identity (because it's convenient to be able to name variables id)
  • Generalises map to fmap, generalises head to Foldable
Summary quit editing summary
Prosedit prosquit editing pros
  • Exports more utility functions than other preludes.
    move trait up move trait down edit trait delete trait
  • The renaming of id to identity is nice.
    move trait up move trait down edit trait delete trait
  • Doesn't do anything radical, so you can start using it quickly.
    move trait up move trait down edit trait delete trait
  • Adds warnings to trace, error and undefined (so you can use them but you're constantly warned that they're still present in code).
    move trait up move trait down edit trait delete trait

press Ctrl+Enter or Enter to addmarkdown supportededit off
Consedit consquit editing cons

    press Ctrl+Enter or Enter to addmarkdown supportededit off
    Ecosystemedit ecosystem

    protolude-lifted – a version with reexports from lifted-base and lifted-async for convenient work in monads other than IO

    Ecosystemquit editing ecosystemor press Ctrl+Enter to savemarkdown supported
    Notes
    collapse notesedit notes

    <notes are empty>

    add something!

    #
    classy-prelude (Hackage)
    large
    move item up move item down edit item info delete item
    Summary edit summary

    A prelude that defines lots of ad-hoc typeclasses (e.g. there's IsMap with methods like lookup, insertMap, etc) and thus removes the need for most qualified imports.

    It also defines some utility functions (whenM, etc) and reexports lots of commonly used modules (from time, mtl, and so on).

    Summary quit editing summary
    Prosedit prosquit editing pros
    • Marks undefined as deprecated (so you'll know if you've accidentally left it in code).
      move trait up move trait down edit trait delete trait
    • Goes further than other preludes in removing boilerplate like qualified names, etc.
      move trait up move trait down edit trait delete trait

    press Ctrl+Enter or Enter to addmarkdown supportededit off
    Consedit consquit editing cons
    • Some people dislike ad-hoc typeclasses.
      move trait up move trait down edit trait delete trait
    • Without qualified names it's hard to understand what type you're operating on.
      move trait up move trait down edit trait delete trait
    • Error messages can be scary.
      move trait up move trait down edit trait delete trait

    press Ctrl+Enter or Enter to addmarkdown supportededit off
    Ecosystemquit editing ecosystemor press Ctrl+Enter to savemarkdown supported
    Notes
    collapse notesedit notes

    <notes are empty>

    add something!

    #
    medium
    move item up move item down edit item info delete item
    Summary edit summary

    Alternative to Prelude from @kowainik. Main design goals for relude:

    • Type-safety and function totality
    • Performance
    • Convenience
    • Minimalism

    See README.md for motivation behind relude.

    Summary quit editing summary
    Prosedit prosquit editing pros
    • Excellent documentation: Haddock with doctest-tested examples, tutorial, migration guide from Prelude.
      move trait up move trait down edit trait delete trait
    • 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.
      move trait up move trait down edit trait delete trait
    • Efficient strings: focuses on using functions with more efficient string types like Text or ByteString instead of String where appropriate.
      move trait up move trait down edit trait delete trait
    • Opt in oriented: contains various extremely useful functions. But they are not exported by default to not spoil global namespace.
      move trait up move trait down edit trait delete trait
    • Custom HLint rules: has custom hlint rules that allow you to improve code quality after migration to relude.
      move trait up move trait down edit trait delete trait

    press Ctrl+Enter or Enter to addmarkdown supportededit off
    Consedit consquit editing cons
    • Medium size: relude is not extremely lightweight. To improve convenience, it depends on most common libraries like bytestring, text, mtl, containers, unordered-containers, deepseq, stm.
      move trait up move trait down edit trait delete trait

    press Ctrl+Enter or Enter to addmarkdown supportededit off
    Ecosystemquit editing ecosystemor press Ctrl+Enter to savemarkdown supported
    Notes
    collapse notesedit notes

    <notes are empty>

    add something!

    #
    base-noprelude (Hackage)
    other
    move item up move item down edit item info delete item
    Summary edit summary

    Not actually an alternative Prelude, but rather a convenient way to define your own Prelude. It re-exports all of base except for Prelude.

    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.

    Summary quit editing summary
    Prosedit prosquit editing pros
    • Assemble your own custom prelude that perfectly fits your needs.
      move trait up move trait down edit trait delete trait
    • No imports or NoImplicitPrelude pragmas at use sites.
      move trait up move trait down edit trait delete trait

    press Ctrl+Enter or Enter to addmarkdown supportededit off
    Consedit consquit editing cons
    • Some assembly required
      move trait up move trait down edit trait delete trait
    • It's possible to make code unreadable by re-defining common names or going overboard with new combinators.
      move trait up move trait down edit trait delete trait

    press Ctrl+Enter or Enter to addmarkdown supportededit off
    Ecosystemedit ecosystem

    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.

    Ecosystemquit editing ecosystemor press Ctrl+Enter to savemarkdown supported
    Notes
    collapse notesedit notes

    <notes are empty>

    add something!

    #
    basic-prelude (Hackage)
    medium
    move item up move item down edit item info delete item
    Summary edit summary

    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 CorePrelude).

    CorePrelude reexports:

    • commonly used functions from Prelude and other base modules
    • types (the usual bunch – Map, Vector, HashMap, ByteString, Text, etc)
    • a selection of functions from other packages (lift and liftIO, </> and <.>, as well as hashing functions from hashable, functions for catching exceptions from lifted-base, and readArgs from ReadArgs, a very simple parser for command line arguments)

    It also reimplements functions like putStrLn and print for Text, and a small number of utility functions (bool, equating).

    BasicPrelude, additionally:

    • reexports Control.Monad, methods of Foldable and Traversable, some functions from Data.List
    • generalises ++, concat, and map
    • replaces read, show, readFile, etc with their Text-based equivalents
    Summary quit editing summary
    Prosedit prosquit editing pros
    • Exports functions from filepath and hashable, which many other preludes don't do.
      move trait up move trait down edit trait delete trait

    press Ctrl+Enter or Enter to addmarkdown supportededit off
    Consedit consquit editing cons
    • Doesn't export &.
      move trait up move trait down edit trait delete trait
    • Focuses on Text, so can be annoying if you use many libraries that need String.
      move trait up move trait down edit trait delete trait
    • Only reimplements a few functions for compatibility with older versions of base (other preludes reimplement more).
      move trait up move trait down edit trait delete trait
    • Feels somewhat opinionated (why hashable and ReadArgs but not more commonly used libraries like deepseq or mtl? etc).
      move trait up move trait down edit trait delete trait

    press Ctrl+Enter or Enter to addmarkdown supportededit off
    Ecosystemedit ecosystem
    Ecosystemquit editing ecosystemor press Ctrl+Enter to savemarkdown supported
    Notes
    collapse notesedit notes

    <notes are empty>

    add something!

    #
    radical
    move item up move item down edit item info delete item
    Summary edit summary

    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.

    Summary quit editing summary
    Prosedit prosquit editing pros

      press Ctrl+Enter or Enter to addmarkdown supportededit off
      Consedit consquit editing cons

        press Ctrl+Enter or Enter to addmarkdown supportededit off
        Ecosystemedit ecosystem
        Ecosystemquit editing ecosystemor press Ctrl+Enter to savemarkdown supported
        Notes
        collapse notesedit notes

        <notes are empty>

        add something!

        #
        base-prelude (Hackage)
        small
        move item up move item down edit item info delete item
        Summary edit summary

        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.)

        Summary quit editing summary
        Prosedit prosquit editing pros
        • You don't have to learn any new functions, or, well, anything. Just plug it in and enjoy not having to import things.
          move trait up move trait down edit trait delete trait
        • Doesn't incur any dependencies.
          move trait up move trait down edit trait delete trait

        press Ctrl+Enter or Enter to addmarkdown supportededit off
        Consedit consquit editing cons
        • Doesn't help with other commonly needed packages (such as text, vector, etc).
          move trait up move trait down edit trait delete trait

        press Ctrl+Enter or Enter to addmarkdown supportededit off
        Ecosystemedit ecosystem

        rebase – uses base-prelude and exports lots of additional modules

        Ecosystemquit editing ecosystemor press Ctrl+Enter to savemarkdown supported
        Notes
        collapse notesedit notes

        <notes are empty>

        add something!

        #
        rebase (Hackage)
        large
        move item up move item down edit item info delete item
        Summary edit summary

        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, Data.Text.IO and Data.Text.Encoding simultaneously. This means that you save some imports and don't have to manually add a dependency.

        It also provides a Rebase.Prelude module that reexports many non-conflicting functions and types from other modules (as well as a huge subset of base, by depending on base-prelude).

        Summary quit editing summary
        Prosedit prosquit editing pros
        • Exports modules in full, not just arbitary subsets.
          move trait up move trait down edit trait delete trait
        • Shaves off more dependency declarations than other libraries.
          move trait up move trait down edit trait delete trait
        • A superset of base-prelude.
          move trait up move trait down edit trait delete trait

        press Ctrl+Enter or Enter to addmarkdown supportededit off
        Consedit consquit editing cons
        • The Rebase.* approach can seem ugly to some.
          move trait up move trait down edit trait delete trait

        press Ctrl+Enter or Enter to addmarkdown supportededit off
        Ecosystemedit ecosystem
        Ecosystemquit editing ecosystemor press Ctrl+Enter to savemarkdown supported
        Notes
        collapse notesedit notes

        <notes are empty>

        add something!

        #
        other
        move item up move item down edit item info delete item
        Summary edit summary

        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: Foldable and Traversable yes, MonoFoldable no.

        • Encourage qualified imports with a consistent naming scheme.

        • Export any non-conflicting and not-discouraged names from this module that make sense, e.g. ByteString, Text, or readIORef.

        Summary quit editing summary
        Prosedit prosquit editing pros

          press Ctrl+Enter or Enter to addmarkdown supportededit off
          Consedit consquit editing cons
          • Not on Hackage yet.
            move trait up move trait down edit trait delete trait

          press Ctrl+Enter or Enter to addmarkdown supportededit off
          Ecosystemedit ecosystem
          Ecosystemquit editing ecosystemor press Ctrl+Enter to savemarkdown supported
          Notes
          collapse notesedit notes

          <notes are empty>

          add something!

          #
          universum (Hackage)
          other
          move item up move item down edit item info delete item
          Summary edit summary

          Custom prelude from @serokell team. You can checkout bigger tutorial in README.md.

          Summary quit editing summary
          Prosedit prosquit editing pros
          • Maintained by company which uses Haskell in production
            move trait up move trait down edit trait delete trait
          • Reexports a lot of things you usually need in your code (containers, transformers, text, etc.)
            move trait up move trait down edit trait delete trait
          • Textual data type is defaulted to Text instead of String
            move trait up move trait down edit trait delete trait
          • All standard IO functions are lifted to MonadIO
            move trait up move trait down edit trait delete trait
          • A lot of commonly used idioms and convenient functions are introduced
            move trait up move trait down edit trait delete trait

          press Ctrl+Enter or Enter to addmarkdown supportededit off
          Consedit consquit editing cons
          • Foldable type hierarchy a little bit reimagined. You might find it unexpected when some things work for Foldable but doesn't work anymore when you're using universum
            move trait up move trait down edit trait delete trait
          • Assumes medium knowledge of Haskell. It's hard to use universum for Haskell beginners, unfortunately.
            move trait up move trait down edit trait delete trait

          press Ctrl+Enter or Enter to addmarkdown supportededit off
          Ecosystemedit ecosystem

          cardano-sl uses universum as a custom prelude.

          Ecosystemquit editing ecosystemor press Ctrl+Enter to savemarkdown supported
          Notes
          collapse notesedit notes

          <notes are empty>

          add something!

          #
          intro (Hackage)
          other
          move item up move item down edit item info delete item
          Summary edit summary

          Minimal prelude which fixes pain points (Text, unsafe functions, etc) in the standard prelude.

          Summary quit editing summary
          Prosedit prosquit editing pros
          • Good support for Text over String.
            move trait up move trait down edit trait delete trait
          • Common IO functions are generalized to work in any MonadIO.
            move trait up move trait down edit trait delete trait
          • Has explicit an export list rather than exporting entire modules. This makes the Haddock documentation so much more useful.
            move trait up move trait down edit trait delete trait
          • Avoids to export unsafe functions
            move trait up move trait down edit trait delete trait

          press Ctrl+Enter or Enter to addmarkdown supportededit off
          Consedit consquit editing cons
          • Does not export 'return' and many other common functions. This means it's a bit of an effort to migrate existing code to the new Prelude.
            move trait up move trait down edit trait delete trait

          press Ctrl+Enter or Enter to addmarkdown supportededit off
          Ecosystemedit ecosystem
          Ecosystemquit editing ecosystemor press Ctrl+Enter to savemarkdown supported
          Notes
          collapse notesedit notes

          <notes are empty>

          add something!

          #
          papa (Hackage)
          other
          move item up move item down edit item info delete item
          Summary edit summary

          Multi-package alternative prelude. papa-base exports the safe and useful things in base. papa-bifunctors exports the safe and useful things in bifunctors. papa itself exports everything from all sub-packages.

          Summary quit editing summary
          Prosedit prosquit editing pros
          • Exports lots of useful functions from many libraries
            move trait up move trait down edit trait delete trait

          press Ctrl+Enter or Enter to addmarkdown supportededit off
          Consedit consquit editing cons
          • papa depends on lens so has a lot of dependencies
            move trait up move trait down edit trait delete trait

          press Ctrl+Enter or Enter to addmarkdown supportededit off
          Ecosystemedit ecosystem
          Ecosystemquit editing ecosystemor press Ctrl+Enter to savemarkdown supported
          Notes
          collapse notesedit notes

          <notes are empty>

          add something!

          #
          SubHask (Hackage)
          radical
          move item up move item down edit item info delete item
          Summary edit summary

          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.

          Summary quit editing summary
          Prosedit prosquit editing pros

            press Ctrl+Enter or Enter to addmarkdown supportededit off
            Consedit consquit editing cons

              press Ctrl+Enter or Enter to addmarkdown supportededit off
              Ecosystemedit ecosystem
              Ecosystemquit editing ecosystemor press Ctrl+Enter to savemarkdown supported
              Notes
              collapse notesedit notes

              <notes are empty>

              add something!

              #
              pregame (Hackage)
              other
              move item up move item down edit item info delete item
              Summary edit summary

              A prelude for applications. Doesn't try to fix anything in Haskell, just reexports lots and lots of packages in a single module (aeson, lens, data-default, and so on; as well as the usual ones like bytestring, text, unordered-containers, etc).

              Summary quit editing summary
              Prosedit prosquit editing pros

                press Ctrl+Enter or Enter to addmarkdown supportededit off
                Consedit consquit editing cons

                  press Ctrl+Enter or Enter to addmarkdown supportededit off
                  Ecosystemedit ecosystem
                  Ecosystemquit editing ecosystemor press Ctrl+Enter to savemarkdown supported
                  Notes
                  collapse notesedit notes

                  <notes are empty>

                  add something!

                  #
                  rio (Hackage)
                  medium
                  move item up move item down edit item info delete item
                  Summary edit summary

                  write something here!

                  Summary quit editing summary
                  Prosedit prosquit editing pros

                    press Ctrl+Enter or Enter to addmarkdown supportededit off
                    Consedit consquit editing cons

                      press Ctrl+Enter or Enter to addmarkdown supportededit off
                      Ecosystemedit ecosystem
                      Ecosystemquit editing ecosystemor press Ctrl+Enter to savemarkdown supported
                      Notes
                      collapse notesedit notes

                      <notes are empty>

                      add something!

                      #
                      Prelude (Hackage)
                      small
                      move item up move item down edit item info delete item
                      Summary edit summary

                      write something here!

                      Summary quit editing summary
                      Prosedit prosquit editing pros

                        press Ctrl+Enter or Enter to addmarkdown supportededit off
                        Consedit consquit editing cons

                          press Ctrl+Enter or Enter to addmarkdown supportededit off
                          Ecosystemedit ecosystem
                          Ecosystemquit editing ecosystemor press Ctrl+Enter to savemarkdown supported
                          Notes
                          collapse notesedit notes

                          <notes are empty>

                          add something!

                          #
                          preliminaries (Hackage)
                          other
                          move item up move item down edit item info delete item
                          Summary edit summary

                          write something here!

                          Summary quit editing summary
                          Prosedit prosquit editing pros

                            press Ctrl+Enter or Enter to addmarkdown supportededit off
                            Consedit consquit editing cons

                              press Ctrl+Enter or Enter to addmarkdown supportededit off
                              Ecosystemedit ecosystem
                              Ecosystemquit editing ecosystemor press Ctrl+Enter to savemarkdown supported
                              Notes
                              collapse notesedit notes

                              <notes are empty>

                              add something!

                              #
                              helium-overture (Hackage)
                              other
                              move item up move item down edit item info delete item
                              Summary edit summary

                              write something here!

                              Summary quit editing summary
                              Prosedit prosquit editing pros

                                press Ctrl+Enter or Enter to addmarkdown supportededit off
                                Consedit consquit editing cons

                                  press Ctrl+Enter or Enter to addmarkdown supportededit off
                                  Ecosystemedit ecosystem
                                  Ecosystemquit editing ecosystemor press Ctrl+Enter to savemarkdown supported
                                  Notes
                                  collapse notesedit notes

                                  <notes are empty>

                                  add something!