enum-text: A text rendering and parsing toolkit for enumerated types

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain]

A text rendering and parsing toolkit for enumerated types. Please see the README on GitHub at https://github.com/cdornan/enum-text#readme


[Skip to ReadMe]

Properties

Versions0.1.0.0, 0.5.0.0, 0.5.0.0, 0.5.1.0
Change logChangeLog.md
Dependenciesarray, base (>=4.8.2 && <10), bytestring, fmt, hashable, possibly, text, time, unordered-containers [details]
LicenseBSD-3-Clause
Copyright2019 Chris Dornan
AuthorChris Dornan
Maintainerchris@chrisdornan.com
CategoryText
Home pagehttps://github.com/cdornan/enum-text#readme
Bug trackerhttps://github.com/cdornan/enum-text/issues
Source repositoryhead: git clone https://github.com/cdornan/enum-text
UploadedSat Mar 16 15:38:01 UTC 2019 by ChrisDornan

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees


Readme for enum-text-0.5.0.0

[back to package description]

enum-text

A simple toolkit for rendering enumerated types into Text Builder (used by the fmt package) and parsing them back again into Text with the provided TextParsable type class.

To get the Buildable and TextParsable instances for an enumerated data type use the following pattern:

import Fmt
import Text.Enum.Text

data Foo = FOO_bar | FOO_bar_baz
  deriving (Bounded,Enum,Eq,Ord,Show)

instance EnumText     Foo
instance Buildable    Foo where build     = buildEnumText
instance TextParsable Foo where parseText = parseEnumText

This will use the default configuration for generating the text of each enumeration from the derived show text, namely:

See the Haddocks for details on how to override this default configuration for any given enumeration type.

Functions for rendering text, generating and parsing UTF-8 encoded ByteStrings (suitable for cassava) and Hashable functions are also provided EnumText.