Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class (Renderable e, Bounded e, Enum e, Eq e, Ord e, Show e, Utf8Parsable e) => EnumUtf8 e where
- configEnumUtf8 :: e -> EnumUtf8Config
- renderEnumUtf8 :: e -> Utf8
- parseEnumUtf8 :: Utf8 -> Possibly e
- toFieldEnumUtf8 :: e -> ByteString
- fromFieldEnumUtf8_ :: Monad m => ByteString -> m e
- hashWithSaltEnumUtf8 :: Int -> e -> Int
- class Utf8Parsable a where
- data EnumUtf8Config = EnumUtf8Config {
- _etc_text_prep :: String -> String
- _etc_char_prep :: Char -> Char
- defaultEnumUtf8Config :: EnumUtf8Config
Documentation
class (Renderable e, Bounded e, Enum e, Eq e, Ord e, Show e, Utf8Parsable e) => EnumUtf8 e where Source #
our toolkit for enumerated types which should be defined as follows:
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]
Nothing
configEnumUtf8 :: e -> EnumUtf8Config Source #
Configures the textual representation of e
generated by renderEnumUtf8.
renderEnumUtf8 :: e -> Utf8 Source #
Generate the standard textual representation according to
configEnumUtf8
by default.
parseEnumUtf8 :: Utf8 -> Possibly e Source #
Parses an e
according to the renderEnumUtf8
render.
toFieldEnumUtf8 :: e -> ByteString Source #
A cassava field encoder, using 'the renderEnumUtf8' format.
fromFieldEnumUtf8_ :: Monad m => ByteString -> m e Source #
A cassava field parser using the renderEnumUtf8
format.
hashWithSaltEnumUtf8 :: Int -> e -> Int Source #
For hashing e
with the renderEnumUtf8
representation.
class Utf8Parsable a where Source #
a class for Text
parsers.
data EnumUtf8Config Source #
configures the default implementation of renderEnumUtf8
EnumUtf8Config | |
|