classy-prelude: A typeclass-based Prelude.

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

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 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, 1.5.0.1, 1.5.0.2, 1.5.0.3
Change log ChangeLog.md
Dependencies async, base (>=4.13 && <5), basic-prelude (>=0.7), bifunctors, bytestring, chunked-data (>=0.3), containers (>=0.4.2), deepseq, dlist (>=0.7), ghc-prim, hashable, mono-traversable (>=1.0), mono-traversable-instances, mtl, mutable-containers (>=0.3 && <0.4), primitive, say, stm, stm-chans (>=3), text, time (>=1.5), transformers, unliftio (>=0.2.1.0), unordered-containers, vector, vector-instances [details]
License MIT
Author Michael Snoyman
Maintainer michael@snoyman.com
Category Control, Prelude
Home page https://github.com/snoyberg/mono-traversable#readme
Bug tracker https://github.com/snoyberg/mono-traversable/issues
Source repo head: git clone https://github.com/snoyberg/mono-traversable
Uploaded by MichaelSnoyman at 2023-08-01T13:03:05Z
Distributions Arch:1.5.0.2, Debian:1.5.0, FreeBSD:0.12.1.1, LTSHaskell:1.5.0.3, NixOS:1.5.0.3, Stackage:1.5.0.3
Reverse Dependencies 57 direct, 161 indirect [details]
Downloads 81440 total (97 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2023-08-01 [all 1 reports]

Readme for classy-prelude-1.5.0.3

[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