MIT licensed by Michael Snoyman
Maintained by [email protected]
This version can be pinned in stack with:classy-prelude-1.5.0.3@sha256:63b6e90643e54b694d2209fab7db9398b9d7d46d7624b3ff57b5f9fccce401c7,1832

Module documentation for 1.5.0.3

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

Changes

ChangeLog for classy-prelude

1.5.0.3

  • Don’t import Data.Functor.unzip #215

1.5.0.2

  • Fix building with time >= 1.10 #207.

1.5.0.1

1.5.0

1.4.0

  • Switch to MonadUnliftIO

1.3.1

  • Add terminal IO functions

1.3.0

  • Tracing functions leave warnings when used

1.2.0.1

  • Use HasCallStack in undefined

1.2.0

1.0.2

  • Export parseTimeM for time >= 1.5

1.0.1

  • Add the say package reexports
  • Add the stm-chans package reexports

1.0.0.2

  • Allow basic-prelude 0.6

1.0.0.1

  • Support for safe-exceptions-0.1.4.0

1.0.0

  • Support for mono-traversable-1.0.0
  • Switch to safe-exceptions
  • Add monad-unlift and lifted-async

0.12.8

  • Add (<&&>),(<||>) #125

0.12.7

  • Concurrency: reexport Control.Concurrent.Lifted and provide yieldThread

0.12.6

  • Regeneralize intercalate #119
  • Add missing exports for traverse_ and for_
  • Generalize mapM_ and forM_ for GHC 7.10

0.12.5.1

  • Support for QuickCheck 2.8.2

0.12.5

  • Expose Alternative and optional

0.12.4

  • Expose traverse_ and for_

0.12.3

  • mono-traversable-0.9.3 support

0.12.2

add errorM, terrorM, and terror

0.12.0

  • Drop system-filepath

0.11.1.1

  • Compatibility with time >= 1.5 #100

0.11.1

  • Fix deprecation warnings for elem

0.11.0

  • Upgrade to mutable-containers 0.3
  • Include dlist support

0.10.5

  • Export Data.Mutable

0.10.4

  • Expose all of Data.Functor

0.10.3

  • Expose liftA functions and <**> #94

0.10.2

  • Provide foldMap and fold as synonyms for concatMap and concat.
  • Switch to more general Traversable-based functions (sequence_ in particular).