Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- module Data.Encoding.Exception
- module Data.Encoding.ByteSource
- module Data.Encoding.ByteSink
- class Encoding enc where
- decodeChar :: ByteSource m => enc -> m Char
- encodeChar :: ByteSink m => enc -> Char -> m ()
- decode :: ByteSource m => enc -> m String
- encode :: ByteSink m => enc -> String -> m ()
- encodeable :: enc -> Char -> Bool
- data DynEncoding
- recode :: (Encoding enc1, Encoding enc2, ByteSource m, ByteSink m) => enc1 -> enc2 -> m ()
- encodeString :: Encoding enc => enc -> String -> String
- encodeStringExplicit :: Encoding enc => enc -> String -> Either EncodingException String
- decodeString :: Encoding enc => enc -> String -> String
- decodeStringExplicit :: Encoding enc => enc -> String -> Either DecodingException String
- encodeLazyByteString :: Encoding enc => enc -> String -> ByteString
- encodeLazyByteStringExplicit :: Encoding enc => enc -> String -> Either EncodingException ByteString
- decodeLazyByteString :: Encoding enc => enc -> ByteString -> String
- decodeLazyByteStringExplicit :: Encoding enc => enc -> ByteString -> Either DecodingException String
- encodeStrictByteString :: Encoding enc => enc -> String -> ByteString
- encodeStrictByteStringExplicit :: Encoding enc => enc -> String -> Either EncodingException ByteString
- decodeStrictByteString :: Encoding enc => enc -> ByteString -> String
- decodeStrictByteStringExplicit :: Encoding enc => enc -> ByteString -> Either DecodingException String
- encodingFromString :: String -> DynEncoding
- encodingFromStringExplicit :: String -> Maybe DynEncoding
Documentation
module Data.Encoding.Exception
module Data.Encoding.ByteSource
module Data.Encoding.ByteSink
class Encoding enc where Source #
The base class for all encodings. At least decodeChar, encodeChar and encodeable must be implemented.
decodeChar :: ByteSource m => enc -> m Char Source #
Read a single character of a ByteSource
encodeChar :: ByteSink m => enc -> Char -> m () Source #
Encode a single character and write it to a ByteSink
decode :: ByteSource m => enc -> m String Source #
Read characters from a ByteSource until it is empty
encode :: ByteSink m => enc -> String -> m () Source #
Encode a String and write it to a ByteSink
encodeable :: enc -> Char -> Bool Source #
Tests whether a given character is representable in the Encoding. If this yields True, encodeChar must not fail. If it yields False, encodeChar _must_ throw an exception.
Instances
data DynEncoding Source #
Wraps all possible encoding types into one data type. Used when a function needs to return an encoding.
Instances
Show DynEncoding Source # | |
Defined in Data.Encoding.Base showsPrec :: Int -> DynEncoding -> ShowS # show :: DynEncoding -> String # showList :: [DynEncoding] -> ShowS # | |
Encoding DynEncoding Source # | |
Defined in Data.Encoding.Base decodeChar :: ByteSource m => DynEncoding -> m Char Source # encodeChar :: ByteSink m => DynEncoding -> Char -> m () Source # decode :: ByteSource m => DynEncoding -> m String Source # encode :: ByteSink m => DynEncoding -> String -> m () Source # encodeable :: DynEncoding -> Char -> Bool Source # | |
Eq DynEncoding Source # | |
Defined in Data.Encoding.Base (==) :: DynEncoding -> DynEncoding -> Bool # (/=) :: DynEncoding -> DynEncoding -> Bool # |
encodeStringExplicit :: Encoding enc => enc -> String -> Either EncodingException String Source #
decodeStringExplicit :: Encoding enc => enc -> String -> Either DecodingException String Source #
encodeLazyByteString :: Encoding enc => enc -> String -> ByteString Source #
encodeLazyByteStringExplicit :: Encoding enc => enc -> String -> Either EncodingException ByteString Source #
decodeLazyByteString :: Encoding enc => enc -> ByteString -> String Source #
decodeLazyByteStringExplicit :: Encoding enc => enc -> ByteString -> Either DecodingException String Source #
encodeStrictByteString :: Encoding enc => enc -> String -> ByteString Source #
encodeStrictByteStringExplicit :: Encoding enc => enc -> String -> Either EncodingException ByteString Source #
decodeStrictByteString :: Encoding enc => enc -> ByteString -> String Source #
decodeStrictByteStringExplicit :: Encoding enc => enc -> ByteString -> Either DecodingException String Source #
encodingFromString :: String -> DynEncoding Source #
Takes the name of an encoding and creates a dynamic encoding from it.
encodingFromStringExplicit :: String -> Maybe DynEncoding Source #
Like encodingFromString
but returns Nothing
instead of throwing an error