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

Safe HaskellNone
LanguageHaskell2010

Text.Enum.Text

Synopsis

Documentation

class (Buildable e, Bounded e, Enum e, Eq e, Ord e, Show e, TextParsable e) => EnumText e where Source #

our toolkit for enumerated types which should be defined as follows:

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

Minimal complete definition

Nothing

Methods

configEnumText :: e -> EnumTextConfig Source #

Configures the textual representation of e generated by renderEnumText.

renderEnumText :: e -> Text Source #

Generate the standard textual representation according to configEnumText by default.

buildEnumText :: e -> Builder Source #

Sames as renderEnumText, but generating a Builder.

parseEnumText :: Text -> Possibly e Source #

Parses an e according to the renderEnumText render.

toFieldEnumText :: e -> ByteString Source #

A cassava field encoder, using 'the renderEnumText' format.

fromFieldEnumText_ :: Monad m => ByteString -> m e Source #

A cassava field parser using the renderEnumText format.

hashWithSaltEnumText :: Int -> e -> Int Source #

For hashing e with the renderEnumText representation.

class TextParsable a where Source #

a class for Text parsers.

Methods

parseText :: Text -> Possibly a Source #

data EnumTextConfig Source #

configures the default implementation of renderEnumText

Constructors

EnumTextConfig 

Fields