prelude-safeenum: A redefinition of the Prelude's Enum class in order to render it safe.

[ bsd3, library, prelude ] [ Propose Tags ] [ Report a vulnerability ]

A redefinition of the Prelude's Enum class in order to render it safe. That is, the Haskell Language Report defines pred, succ, fromEnum, and toEnum to be partial functions when the type is Bounded, but this is unacceptable. We define a new type-class hierarchy for enumeration which is safe and also generalizes to cover types which can only be enumerated in one direction.


[Skip to Readme]

Flags

Automatic Flags
NameDescriptionDefault
base4

base-4.0 emits "Prelude deprecated" messages in order to get people to be explicit about which version of base they use.

Enabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0, 0.1.0.1, 0.1.1, 0.1.1.1, 0.1.1.2, 0.1.1.3
Dependencies base (<5) [details]
Tested with ghc ==6.12.1, ghc ==7.6.1
License BSD-3-Clause
Copyright Copyright (c) 2012--2013 wren ng thornton
Author wren ng thornton
Maintainer wren@community.haskell.org
Category Prelude
Home page http://code.haskell.org/~wren/
Source repo head: darcs get http://community.haskell.org/~wren/prelude-safeenum
Uploaded by WrenThornton at 2013-06-01T22:57:57Z
Distributions LTSHaskell:0.1.1.3, NixOS:0.1.1.3, Stackage:0.1.1.3
Reverse Dependencies 2 direct, 0 indirect [details]
Downloads 5379 total (13 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for prelude-safeenum-0.1.0.1

[back to package description]
prelude-safeenum
================

This is a very simple package and should be easy to install. You
should be able to use any of the following standard methods to
install it.

    -- With cabal-install and without the source:
    $> cabal install prelude-safeenum
    
    -- With cabal-install and with the source already:
    $> cd prelude-safeenum
    $> cabal install
    
    -- Without cabal-install, but with the source already:
    $> cd prelude-safeenum
    $> runhaskell Setup.hs configure --user
    $> runhaskell Setup.hs build
    $> runhaskell Setup.hs test
    $> runhaskell Setup.hs haddock --hyperlink-source
    $> runhaskell Setup.hs copy
    $> runhaskell Setup.hs register

The test step is optional and currently does nothing. The Haddock
step is also optional.


Portability
===========

An attempt has been made to keep this library portable; however,
it does rely on a few language extensions. All the required language
extensions are:

    CPP
    GeneralizedNewtypeDeriving
    MagicHash    -- only for GHC
    Trustworthy  -- only for GHC >= 7.1

The GeneralizedNewtypeDeriving extension is used for brevity in
Data.Number.CalkinWilf. If you'd like to use this package with a
compiler that does not support that extension, contact the maintainer
and it can be removed.

This package is only "Trustworthy" rather than "Safe" for two
reasons: (1) Data.Number.CalkinWilf uses GeneralizedNewtypeDeriving,
and (2) Prelude.SafeEnum imports GHC.Exts for build/foldr fusion
and for the Char instances.

----------------------------------------------------------- fin.