enum-utf8: An experimental Utf8 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] [Publish]

An experimental Utf8 rendering and parsing toolkit for enumerated types based on enum-text and render-utf8. Please see the README on GitHub at https://github.com/cdornan/enum-text#readme

[Skip to Readme]


Change log ChangeLog.md
Dependencies array, base (>=4.8.2 && <10), bytestring, hashable, possibly, render-utf8, unordered-containers [details]
License BSD-3-Clause
Copyright 2019 Chris Dornan
Author Chris Dornan
Maintainer chris@chrisdornan.com
Category Text
Home page https://github.com/cdornan/enum-text#readme
Bug tracker https://github.com/cdornan/enum-text/issues
Source repo head: git clone https://github.com/cdornan/enum-text
Uploaded by ChrisDornan at 2019-03-16T01:00:06Z


[Index] [Quick Jump]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Readme for enum-utf8-

[back to package description]


An experimental toolkit for rendering enumerated types into Utf8 from the render-utf8 package) and parsing them back again with the provided Utf8Parsable type class. It is based on the render-utf8 and enum-text packages.

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

import Text.Enum.Utf8
import Text.Utf8

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

instance EnumUtf8     Foo
instance Renderable   Foo where render    = renderEnumUtf8
instance Utf8Parsable Foo where parseUtf8 = parseEnumUtf8

main :: IO ()
main = mapM_ (cvtLn . render) [minBound..maxBound::Foo]

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 generating and parsing UTF-8 encoded ByteStrings (suitable for cassava), as are Hashable functions.