-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A library for various character encodings
--
-- Haskell has excellect handling of unicode, the Char type covers all
-- unicode chars. Unfortunatly, there's no possibility to read or write
-- something to the outer world in an encoding other than ascii due to
-- the lack of support for encodings. This library should help with that.
@package encoding
@version 0.5.2
module Control.Throws
class Throws e m
throwException :: (Throws e m) => e -> m a
instance (Throws e m) => Throws e (ReaderT s m)
instance (Throws e m) => Throws e (StateT s m)
instance (Exception e) => Throws e IO
instance Throws e (Either e)
instance (Exception e) => Throws e Identity
module Data.Encoding.Exception
-- | This exception type is thrown whenever something went wrong during the
-- encoding-process.
data EncodingException
-- | Thrown if a specific character is not representable in an encoding.
HasNoRepresentation :: Char -> EncodingException
-- | This exception type is thrown whenever something went wrong during the
-- decoding-process.
data DecodingException
-- | The sequence contained an illegal byte that couldn't be decoded.
IllegalCharacter :: Word8 -> DecodingException
-- | more bytes were needed to allow a successfull decoding.
UnexpectedEnd :: DecodingException
-- | the decoded value was out of the unicode range
OutOfRange :: DecodingException
-- | The character sequence encodes a character, but is illegal.
IllegalRepresentation :: [Word8] -> DecodingException
instance Typeable DecodingException
instance Typeable EncodingException
instance Eq DecodingException
instance Show DecodingException
instance Eq EncodingException
instance Show EncodingException
instance Exception DecodingException
instance Exception EncodingException
module Data.Encoding.ByteSource
class (Monad m, Throws DecodingException m) => ByteSource m
sourceEmpty :: (ByteSource m) => m Bool
fetchWord8 :: (ByteSource m) => m Word8
fetchAhead :: (ByteSource m) => m a -> m a
fetchWord16be :: (ByteSource m) => m Word16
fetchWord16le :: (ByteSource m) => m Word16
fetchWord32be :: (ByteSource m) => m Word32
fetchWord32le :: (ByteSource m) => m Word32
fetchWord64be :: (ByteSource m) => m Word64
fetchWord64le :: (ByteSource m) => m Word64
instance ByteSource (ReaderT Handle IO)
instance ByteSource (StateT ByteString (Either DecodingException))
instance ByteSource (StateT ByteString (Either DecodingException))
instance ByteSource (State ByteString)
instance Throws DecodingException (State ByteString)
instance ByteSource (StateT [Char] (Either DecodingException))
instance Monad (Either DecodingException)
instance ByteSource (State [Char])
instance Throws DecodingException (State [Char])
instance ByteSource Get
instance Throws DecodingException Get
module Data.Encoding.ByteSink
class (Monad m, Throws EncodingException m) => ByteSink m
pushWord8 :: (ByteSink m) => Word8 -> m ()
pushWord16be :: (ByteSink m) => Word16 -> m ()
pushWord16le :: (ByteSink m) => Word16 -> m ()
pushWord32be :: (ByteSink m) => Word32 -> m ()
pushWord32le :: (ByteSink m) => Word32 -> m ()
pushWord64be :: (ByteSink m) => Word64 -> m ()
pushWord64le :: (ByteSink m) => Word64 -> m ()
newtype PutME a
PutME :: (Either EncodingException (PutM (), a)) -> PutME a
newtype StrictSink a
StrictS :: (Ptr Word8 -> Int -> Int -> IO (a, Ptr Word8, Int, Int)) -> StrictSink a
newtype StrictSinkE a
StrictSinkE :: (StrictSink (Either EncodingException a)) -> StrictSinkE a
createStrictWithLen :: StrictSink a -> Int -> (a, ByteString)
createStrict :: StrictSink a -> (a, ByteString)
newtype StrictSinkExplicit a
StrictSinkExplicit :: (StrictSink (Either EncodingException a)) -> StrictSinkExplicit a
instance ByteSink (ReaderT Handle IO)
instance ByteSink StrictSinkExplicit
instance Throws EncodingException StrictSinkExplicit
instance Monad StrictSinkExplicit
instance ByteSink StrictSinkE
instance Throws EncodingException StrictSinkE
instance Monad StrictSinkE
instance ByteSink StrictSink
instance Throws EncodingException StrictSink
instance Monad StrictSink
instance ByteSink (StateT (Seq Char) (Either EncodingException))
instance ByteSink (State (Seq Char))
instance Throws EncodingException (State (Seq Char))
instance Monad (Either EncodingException)
instance ByteSink PutME
instance Throws EncodingException PutME
instance Monad PutME
instance ByteSink PutM
instance Throws EncodingException PutM
module Data.Encoding.ASCII
data ASCII
ASCII :: ASCII
instance Typeable ASCII
instance Show ASCII
instance Eq ASCII
instance Encoding ASCII
module Data.Encoding.ISO88592
data ISO88592
ISO88592 :: ISO88592
encoding_arr_ISO88592 :: UArray Word8 Int
decoding_map_ISO88592 :: Map Char Word8
instance Typeable ISO88592
instance Show ISO88592
instance Eq ISO88592
instance Encoding ISO88592
module Data.Encoding.ISO88593
data ISO88593
ISO88593 :: ISO88593
encoding_arr_ISO88593 :: UArray Word8 Int
decoding_map_ISO88593 :: Map Char Word8
instance Typeable ISO88593
instance Show ISO88593
instance Eq ISO88593
instance Encoding ISO88593
module Data.Encoding.ISO88594
data ISO88594
ISO88594 :: ISO88594
encoding_arr_ISO88594 :: UArray Word8 Int
decoding_map_ISO88594 :: Map Char Word8
instance Typeable ISO88594
instance Show ISO88594
instance Eq ISO88594
instance Encoding ISO88594
module Data.Encoding.ISO88595
data ISO88595
ISO88595 :: ISO88595
encoding_arr_ISO88595 :: UArray Word8 Int
decoding_map_ISO88595 :: Map Char Word8
instance Typeable ISO88595
instance Show ISO88595
instance Eq ISO88595
instance Encoding ISO88595
module Data.Encoding.ISO88596
data ISO88596
ISO88596 :: ISO88596
encoding_arr_ISO88596 :: UArray Word8 Int
decoding_map_ISO88596 :: Map Char Word8
instance Typeable ISO88596
instance Show ISO88596
instance Eq ISO88596
instance Encoding ISO88596
module Data.Encoding.ISO88597
data ISO88597
ISO88597 :: ISO88597
encoding_arr_ISO88597 :: UArray Word8 Int
decoding_map_ISO88597 :: Map Char Word8
instance Typeable ISO88597
instance Show ISO88597
instance Eq ISO88597
instance Encoding ISO88597
module Data.Encoding.ISO88598
data ISO88598
ISO88598 :: ISO88598
encoding_arr_ISO88598 :: UArray Word8 Int
decoding_map_ISO88598 :: Map Char Word8
instance Typeable ISO88598
instance Show ISO88598
instance Eq ISO88598
instance Encoding ISO88598
module Data.Encoding.ISO88599
data ISO88599
ISO88599 :: ISO88599
encoding_arr_ISO88599 :: UArray Word8 Int
decoding_map_ISO88599 :: Map Char Word8
instance Typeable ISO88599
instance Show ISO88599
instance Eq ISO88599
instance Encoding ISO88599
module Data.Encoding.ISO885910
data ISO885910
ISO885910 :: ISO885910
encoding_arr_ISO885910 :: UArray Word8 Int
decoding_map_ISO885910 :: Map Char Word8
instance Typeable ISO885910
instance Show ISO885910
instance Eq ISO885910
instance Encoding ISO885910
module Data.Encoding.ISO885911
data ISO885911
ISO885911 :: ISO885911
encoding_arr_ISO885911 :: UArray Word8 Int
decoding_map_ISO885911 :: Map Char Word8
instance Typeable ISO885911
instance Show ISO885911
instance Eq ISO885911
instance Encoding ISO885911
module Data.Encoding.ISO885913
data ISO885913
ISO885913 :: ISO885913
encoding_arr_ISO885913 :: UArray Word8 Int
decoding_map_ISO885913 :: Map Char Word8
instance Typeable ISO885913
instance Show ISO885913
instance Eq ISO885913
instance Encoding ISO885913
module Data.Encoding.ISO885914
data ISO885914
ISO885914 :: ISO885914
encoding_arr_ISO885914 :: UArray Word8 Int
decoding_map_ISO885914 :: Map Char Word8
instance Typeable ISO885914
instance Show ISO885914
instance Eq ISO885914
instance Encoding ISO885914
module Data.Encoding.ISO885915
data ISO885915
ISO885915 :: ISO885915
encoding_arr_ISO885915 :: UArray Word8 Int
decoding_map_ISO885915 :: Map Char Word8
instance Typeable ISO885915
instance Show ISO885915
instance Eq ISO885915
instance Encoding ISO885915
module Data.Encoding.ISO885916
data ISO885916
ISO885916 :: ISO885916
encoding_arr_ISO885916 :: UArray Word8 Int
decoding_map_ISO885916 :: Map Char Word8
instance Typeable ISO885916
instance Show ISO885916
instance Eq ISO885916
instance Encoding ISO885916
module Data.Encoding.CP1250
data CP1250
CP1250 :: CP1250
encoding_arr_CP1250 :: UArray Word8 Int
decoding_map_CP1250 :: Map Char Word8
instance Typeable CP1250
instance Show CP1250
instance Eq CP1250
instance Encoding CP1250
module Data.Encoding.CP1251
data CP1251
CP1251 :: CP1251
encoding_arr_CP1251 :: UArray Word8 Int
decoding_map_CP1251 :: Map Char Word8
instance Typeable CP1251
instance Show CP1251
instance Eq CP1251
instance Encoding CP1251
module Data.Encoding.CP1252
data CP1252
CP1252 :: CP1252
encoding_arr_CP1252 :: UArray Word8 Int
decoding_map_CP1252 :: Map Char Word8
instance Typeable CP1252
instance Show CP1252
instance Eq CP1252
instance Encoding CP1252
module Data.Encoding.CP1253
data CP1253
CP1253 :: CP1253
encoding_arr_CP1253 :: UArray Word8 Int
decoding_map_CP1253 :: Map Char Word8
instance Typeable CP1253
instance Show CP1253
instance Eq CP1253
instance Encoding CP1253
module Data.Encoding.CP1254
data CP1254
CP1254 :: CP1254
encoding_arr_CP1254 :: UArray Word8 Int
decoding_map_CP1254 :: Map Char Word8
instance Typeable CP1254
instance Show CP1254
instance Eq CP1254
instance Encoding CP1254
module Data.Encoding.CP1255
data CP1255
CP1255 :: CP1255
encoding_arr_CP1255 :: UArray Word8 Int
decoding_map_CP1255 :: Map Char Word8
instance Typeable CP1255
instance Show CP1255
instance Eq CP1255
instance Encoding CP1255
module Data.Encoding.CP1256
data CP1256
CP1256 :: CP1256
encoding_arr_CP1256 :: UArray Word8 Int
decoding_map_CP1256 :: Map Char Word8
instance Typeable CP1256
instance Show CP1256
instance Eq CP1256
instance Encoding CP1256
module Data.Encoding.CP1257
data CP1257
CP1257 :: CP1257
encoding_arr_CP1257 :: UArray Word8 Int
decoding_map_CP1257 :: Map Char Word8
instance Typeable CP1257
instance Show CP1257
instance Eq CP1257
instance Encoding CP1257
module Data.Encoding.CP1258
data CP1258
CP1258 :: CP1258
encoding_arr_CP1258 :: UArray Word8 Int
decoding_map_CP1258 :: Map Char Word8
instance Typeable CP1258
instance Show CP1258
instance Eq CP1258
instance Encoding CP1258
module Data.Encoding.MacOSRoman
data MacOSRoman
MacOSRoman :: MacOSRoman
encoding_arr_MacOSRoman :: UArray Word8 Int
decoding_map_MacOSRoman :: Map Char Word8
instance Typeable MacOSRoman
instance Show MacOSRoman
instance Eq MacOSRoman
instance Encoding MacOSRoman
module Data.Encoding.JISX0201
data JISX0201
JISX0201 :: JISX0201
encoding_arr_JISX0201 :: UArray Word8 Int
decoding_map_JISX0201 :: Map Char Word8
instance Typeable JISX0201
instance Show JISX0201
instance Eq JISX0201
instance Encoding JISX0201
module Data.Encoding.JISX0208
data JISX0208
JISX0208 :: JISX0208
encoding_arr_JISX0208 :: UArray (Word8, Word8) Int
decoding_map_JISX0208 :: Map Char (Word8, Word8)
instance Typeable JISX0208
instance Show JISX0208
instance Eq JISX0208
instance Encoding JISX0208
module Data.Encoding.JISX0212
data JISX0212
JISX0212 :: JISX0212
encoding_arr_JISX0212 :: UArray (Word8, Word8) Int
decoding_map_JISX0212 :: Map Char (Word8, Word8)
instance Typeable JISX0212
instance Show JISX0212
instance Eq JISX0212
instance Encoding JISX0212
-- | This module implements UTF-8 encoding and decoding as in RFC 3629. See
-- http://en.wikipedia.org/wiki/UTF-8 for more information.
module Data.Encoding.UTF8
data UTF8
-- | Very forgiving decoding mechanism, accepts everything that it can make
-- any sense of.
UTF8 :: UTF8
-- | More strict decoding, doesn't accept sequences that have a too long
-- representation and checks bits that aren't used in the decoding
UTF8Strict :: UTF8
instance Typeable UTF8
instance Eq UTF8
instance Show UTF8
instance Encoding UTF8
-- | This module implements UTF-16 encoding and decoding as in RFC 2781.
-- See http://en.wikipedia.org/wiki/UTF-16 for more information.
module Data.Encoding.UTF16
data UTF16
-- | Decodes big and little endian, encodes big endian.
UTF16 :: UTF16
-- | Big endian decoding and encoding, fails if the string isn't actually
-- big endian.
UTF16BE :: UTF16
-- | Little endian decoding and encoding.
UTF16LE :: UTF16
instance Typeable UTF16
instance Eq UTF16
instance Show UTF16
instance Encoding UTF16
-- | This module implements UTF-32 encoding and decoding. See
-- http://en.wikipedia.org/wiki/UTF-32 for more information.
module Data.Encoding.UTF32
data UTF32
-- | Detects big or little endian through the use of the BOM (Byte Order
-- Mask) character. Defaults to big endian if not present.
UTF32 :: UTF32
-- | Encodes and decodes using the big endian encoding.
UTF32BE :: UTF32
-- | Encodes and decodes using the little endian encoding.
UTF32LE :: UTF32
instance Typeable UTF32
instance Eq UTF32
instance Show UTF32
instance Encoding UTF32
module Data.Encoding.ISO88591
data ISO88591
ISO88591 :: ISO88591
instance Typeable ISO88591
instance Show ISO88591
instance Eq ISO88591
instance Encoding ISO88591
-- | This module implements KOI8-R encoding which covers the russian and
-- bulgarian alphabet. See http://en.wikipedia.org/wiki/KOI8-R for
-- more information.
module Data.Encoding.KOI8R
data KOI8R
KOI8R :: KOI8R
instance Typeable KOI8R
instance Eq KOI8R
instance Show KOI8R
instance Encoding KOI8R
-- | This module implements KOI8-U encoding which covers the ukrainian
-- alphabet. See http://en.wikipedia.org/wiki/KOI8-U for more
-- information.
module Data.Encoding.KOI8U
data KOI8U
KOI8U :: KOI8U
instance Typeable KOI8U
instance Eq KOI8U
instance Show KOI8U
instance Encoding KOI8U
-- | GB18030 is a chinese character encoding that is mandatory in china (if
-- you - don't implement it, you're not allowed to sell your software
-- there).
module Data.Encoding.GB18030
data GB18030
GB18030 :: GB18030
instance Typeable GB18030
instance Eq GB18030
instance Show GB18030
instance Encoding GB18030
-- | This implements BootString en- and decoding, the foundation of
-- Punycode
module Data.Encoding.BootString
data BootString
BootString :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> BootString
base :: BootString -> Int
tmin :: BootString -> Int
tmax :: BootString -> Int
skew :: BootString -> Int
damp :: BootString -> Int
init_bias :: BootString -> Int
init_n :: BootString -> Int
punycode :: BootString
instance Typeable BootString
instance Show BootString
instance Eq BootString
instance Encoding BootString
module Data.Encoding.ISO2022
class ISO2022 e
readEscape :: (ISO2022 e, ByteSource m) => e -> m (Maybe DynEncoding)
encodingForChar :: (ISO2022 e) => e -> Char -> Maybe (DynEncoding, [Word8])
encodeCharISO2022 :: (ISO2022 e, ByteSink m) => e -> Char -> m ()
decodeCharISO2022 :: (ISO2022 e, ByteSource m) => e -> m Char
encodeISO2022 :: (ISO2022 e, ByteSink m) => e -> String -> m ()
decodeISO2022 :: (ISO2022 e, ByteSource m) => e -> m String
-- | Implements the japanese character encoding ISO 2022-JP. See
-- http:tools.ietf.orghtmlrfc1468 for reference.
module Data.Encoding.ISO2022JP
data ISO2022JP
ISO2022JP :: ISO2022JP
instance Typeable ISO2022JP
instance Eq ISO2022JP
instance Show ISO2022JP
instance ISO2022 ISO2022JP
instance Encoding ISO2022JP
module Data.Encoding
class Encoding enc
decodeChar :: (Encoding enc, ByteSource m) => enc -> m Char
encodeChar :: (Encoding enc, ByteSink m) => enc -> Char -> m ()
decode :: (Encoding enc, ByteSource m) => enc -> m String
encode :: (Encoding enc, ByteSink m) => enc -> String -> m ()
encodeable :: (Encoding enc) => 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
-- | Takes the name of an encoding and creates a dynamic encoding from it.
encodingFromString :: String -> DynEncoding
-- | Like encodingFromString but returns Nothing instead of
-- throwing an error
encodingFromStringExplicit :: String -> Maybe DynEncoding
-- | This module provides a replacement for the normal (unicode unaware) IO
-- functions of haskell. By using implicit parameters, it can be used
-- almost as a drop-in replacement.
module System.IO.Encoding
-- | Returns the encoding used on the current system.
getSystemEncoding :: IO DynEncoding
getContents :: (Encoding e, ?enc :: e) => IO String
-- | Like the normal System.IO.hPutStr, but encodes the output using an
-- encoding.
hPutStr :: (Encoding e, ?enc :: e) => Handle -> String -> IO ()
hPutStrLn :: (Encoding e, ?enc :: e) => Handle -> String -> IO ()
-- | Like the normal System.IO.hGetContents, but decodes the input using an
-- encoding.
hGetContents :: (Encoding e, ?enc :: e) => Handle -> IO String
readFile :: (Encoding e, ?enc :: e) => FilePath -> IO String
writeFile :: (Encoding e, ?enc :: e) => FilePath -> String -> IO ()
appendFile :: (Encoding e, ?enc :: e) => FilePath -> String -> IO ()
hGetChar :: (Encoding e, ?enc :: e) => Handle -> IO Char
hGetLine :: (Encoding e, ?enc :: e) => Handle -> IO String
hPutChar :: (Encoding e, ?enc :: e) => Handle -> Char -> IO ()
interact :: (Encoding e, ?enc :: e) => (String -> String) -> IO ()
print :: (Encoding e, Show a, ?enc :: e) => a -> IO ()