classy-prelude: A typeclass-based Prelude.

[ control, library, mit, prelude ] [ Propose Tags ]

Modern best practices without name collisions. No partial functions are exposed, but modern data structures are, without requiring import lists. Qualified modules also are not needed: instead operations are based on type-classes from the mono-traversable package.


[Skip to Readme]
Versions 0.1.0.0, 0.2.0.0, 0.2.0.1, 0.3.0, 0.3.1, 0.4.0, 0.4.0.1, 0.4.1, 0.4.2, 0.4.3, 0.4.4, 0.5.0, 0.5.1, 0.5.2, 0.5.3, 0.5.4, 0.5.6, 0.5.7, 0.5.8, 0.5.9, 0.5.10, 0.6.0, 0.6.0.1, 0.7.0, 0.8.0, 0.8.0.1, 0.8.1, 0.8.1.1, 0.8.2, 0.8.3, 0.8.3.1, 0.9.0, 0.9.1, 0.9.2, 0.9.3, 0.9.4, 0.9.5, 0.10.0, 0.10.1, 0.10.2, 0.10.3, 0.10.4, 0.10.5, 0.11.0, 0.11.1, 0.11.1.1, 0.12.0, 0.12.0.1, 0.12.1, 0.12.1.1, 0.12.3, 0.12.4, 0.12.5, 0.12.5.1, 0.12.6, 0.12.7, 0.12.8, 1.0.0, 1.0.0.1, 1.0.0.2, 1.0.1, 1.0.2, 1.2.0, 1.2.0.1, 1.3.0, 1.3.1, 1.4.0, 1.5.0
Change log ChangeLog.md
Dependencies async, base (==4.*), basic-prelude (>=0.4 && <0.7), bifunctors, bytestring, chunked-data (>=0.3), containers (>=0.4.2), deepseq, dlist (>=0.7), exceptions (>=0.5), ghc-prim, hashable, lifted-async (>=0.3), lifted-base (>=0.2), monad-unlift (>=0.2), mono-traversable (>=1.0), mono-traversable-instances, mtl, mutable-containers (==0.3.*), primitive, safe-exceptions (>=0.1.1), say, semigroups, stm (<2.5), stm-chans (>=3), text, time, time-locale-compat, transformers, transformers-base, unordered-containers, vector, vector-instances [details]
License MIT
Author Michael Snoyman
Maintainer michael@snoyman.com
Revised Revision 1 made by HerbertValerioRiedel at Fri Oct 5 23:42:20 UTC 2018
Category Control, Prelude
Home page https://github.com/snoyberg/mono-traversable
Source repo head: git clone https://github.com/snoyberg/mono-traversable.git
Uploaded by MichaelSnoyman at Sun Jan 22 09:30:12 UTC 2017
Distributions Debian:1.4.0, FreeBSD:0.12.1.1, LTSHaskell:1.4.0, NixOS:1.5.0, Stackage:1.5.0
Downloads 37397 total (204 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-01-22 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees


Readme for classy-prelude-1.2.0

[back to package description]

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