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.


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 logChangeLog.md
Dependenciesarray, base (>=4.8.2 && <10), bytestring, hashable, possibly, render-utf8, unordered-containers [details]
Copyright2019 Chris Dornan
AuthorChris Dornan
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 01:00:06 UTC 2019 by ChrisDornan




Maintainers' corner

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.