Switch branches/tags
mutable-containers/0.3.3 mutable-containers-0.3.4 mono-traversable/1.0.6.0 mono-traversable/1.0.5.0 mono-traversable/1.0.4.0 mono-traversable/1.0.2.1 mono-traversable/1.0.2 mono-traversable/1.0.1.3 mono-traversable/1.0.1.2 mono-traversable/1.0.1.1 mono-traversable/1.0.1 mono-traversable/1.0.0.1 mono-traversable/1.0.0 mono-traversable/0.10.2 mono-traversable/0.10.1.1 mono-traversable/0.10.1 mono-traversable/0.10.0.1 mono-traversable/0.10.0 mono-traversable/0.9.3 mono-traversable/0.9.2.1 mono-traversable/0.9.2 mono-traversable/0.9.1 mono-traversable/0.9.0.2 mono-traversable/0.9.0.1 mono-traversable/0.9.0 mono-traversable/0.8.0.1 mono-traversable/0.8.0 mono-traversable/0.7.0 mono-traversable/0.6.3 mono-traversable/0.6.2 mono-traversable/0.6.1 mono-traversable/0.6.0.4 mono-traversable/0.6.0.3 mono-traversable/0.6.0.2 mono-traversable/0.6.0.1 mono-traversable/0.6.0 mono-traversable/0.5.0 mono-traversable/0.4.0.4 mono-traversable/0.4.0.3 mono-traversable/0.4.0.2 mono-traversable/0.4.0.1 mono-traversable/0.4.0 mono-traversable/0.3.1 mono-traversable/0.3.0.3 mono-traversable/0.3.0.2 mono-traversable/0.3.0.1 mono-traversable/0.3.0.0 mono-traversable/0.2.0.0 mono-traversable/0.1.0.0 mono-traversable-instances/0.1.0.0 mono-traversable-1.0.9.0 mono-traversable-1.0.8.1 mono-traversable-1.0.8.0 mono-traversable-1.0.7.0 conduit-combinators/1.1.2 conduit-combinators/1.1.1 conduit-combinators/1.1.0 conduit-combinators/1.0.8.3 conduit-combinators/1.0.8.2 conduit-combinators/1.0.8.1 conduit-combinators/1.0.8 conduit-combinators/1.0.7 conduit-combinators/1.0.6 conduit-combinators/1.0.5 conduit-combinators/1.0.4 conduit-combinators-1.3.0 classy-prelude/1.3.1 classy-prelude/1.3.0 classy-prelude/1.2.0.1 classy-prelude/1.2.0 classy-prelude/1.0.2 classy-prelude/1.0.1 classy-prelude/1.0.0.2 classy-prelude/1.0.0.1 classy-prelude/1.0.0 classy-prelude-yesod/1.3.1 classy-prelude-yesod/1.3.0 classy-prelude-yesod/1.2.0 classy-prelude-yesod/1.1.0 classy-prelude-yesod/1.0.2 classy-prelude-yesod/1.0.1 classy-prelude-yesod/1.0.0 classy-prelude-yesod-1.5.0 classy-prelude-yesod-1.4.0 classy-prelude-conduit/1.3.1 classy-prelude-conduit/1.3.0 classy-prelude-conduit/1.2.0 classy-prelude-conduit/1.0.2 classy-prelude-conduit/1.0.1 classy-prelude-conduit/1.0.0 classy-prelude-conduit-1.5.0 classy-prelude-conduit-1.4.0 classy-prelude-1.5.0 classy-prelude-1.4.0 chunked-data/0.3.0 chunked-data-0.3.1
Nothing to show
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
src
test
ChangeLog.md
LICENSE
README.md
Setup.hs
package.yaml

README.md

classy-prelude

A better Prelude. Haskell's Prelude needs to maintain backwards compatibility and has many aspects that no longer represents best practice. The goals of classy-prelude are:

  • remove all partial functions
  • modernize data structures
    • generally use Text instead of String
    • encourage the use of appropriate data structures such as Vectors or HashMaps instead of always using lists and associated lists
  • reduce import lists and the need for qualified imports

classy-prelude should only be used by application developers. Library authors should consider using mono-traversable, which classy-prelude builds upon.

It is worth noting that classy-prelude largely front-ran changes that the community made to the base Prelude in GHC 7.10.

mono-traversable

Most of this functionality is provided by mono-traversable. Please read the README over there. classy-prelude gets rid of the o prefix from mono-traversable functions.

Text

Lots of things use Text instead of String. Note that show returns a String. To get back Text, use tshow.

other functionality

  • exceptions package
  • system-filepath convenience functions
  • whenM, unlessM
  • hashNub and ordNub (efficient nub implementations).

Using classy-prelude

  • use the NoImplicitPrelude extension (you can place this in your cabal file) and import ClassyPrelude
  • use base-noprelude in your project and define a Prelude module that re-exports ClassyPrelude.

Appendix

These blog posts contain some out-dated information but might be helpful