Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class (Buildable e, Bounded e, Enum e, Eq e, Ord e, Show e, TextParsable e) => EnumText e where
- configEnumText :: e -> EnumTextConfig
- renderEnumText :: e -> Text
- buildEnumText :: e -> Builder
- parseEnumText :: Text -> Possibly e
- toFieldEnumText :: e -> ByteString
- fromFieldEnumText_ :: Monad m => ByteString -> m e
- hashWithSaltEnumText :: Int -> e -> Int
- class TextParsable a where
- data EnumTextConfig = EnumTextConfig {
- _etc_text_prep :: Text -> Text
- _etc_char_prep :: Char -> Char
- defaultEnumTextConfig :: EnumTextConfig
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
Nothing
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.
data EnumTextConfig Source #
configures the default implementation of renderEnumText
EnumTextConfig | |
|