-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Convert legacy byte encodings to and from Unicode
--
-- Provides simple functions Word8 -> Char and Char ->
-- Either Char Word8 for converting from legacy character encodings
-- to Unicode and back.
@package char-decode
@version 0.0.1
-- | Simple utilities for converting between legacy byte encodings and
-- Unicode.
module Data.Char.Decode
-- | Represents encodings of bytes as characters. It's not expected that
-- you will need to implement this class directly.
class ByteEncoding enc
-- | Mapping from bytes to chars.
decodeByte :: ByteEncoding enc => enc -> Word8 -> Char
-- | Mapping from chars to bytes. If the character c has no analog
-- in the encoding, returns Left c.
encodeByte :: ByteEncoding enc => enc -> Char -> Either Char Word8
-- | Convert a legacy encoded ByteString to a UTF-8 encoded
-- Text.
decodeToText :: ByteEncoding enc => enc -> ByteString -> Text
-- | Convert a legacy encoded ByteString to a UTF-8 encoded
-- String.
decodeToString :: ByteEncoding enc => enc -> ByteString -> String
-- | If the character has no analog in the encoding, returns the default
-- byte.
encodeWithDefault :: ByteEncoding enc => enc -> Word8 -> Char -> Word8
-- | If any input characters are out of range, returns Left c
-- where c is the first such character.
encodeFromText :: ByteEncoding enc => enc -> Text -> Either Char ByteString
-- | If any input characters are out of range, replace them with the given
-- default.
encodeFromTextWithDefault :: ByteEncoding enc => enc -> Word8 -> Text -> ByteString
-- | If any input characters are out of range, returns Left c
-- where c is the first such character.
encodeFromString :: ByteEncoding enc => enc -> String -> Either Char ByteString
-- | If any input characters are out of range, replace them with the given
-- default.
encodeFromStringWithDefault :: ByteEncoding enc => enc -> Word8 -> String -> ByteString
-- | Data from
-- ftp://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/PC/CP437.TXT
data CodePage437
CodePage437 :: CodePage437
-- | Data from https://en.wikipedia.org/wiki/Code_page_437
data CodePage437Graphic
CodePage437Graphic :: CodePage437Graphic
-- | Extract the least significant byte (byte 0) of a UTF-8 code point.
byte0 :: Char -> Word8
-- | Extract the next-to-least significant byte (byte 1) of a UTF-8 code
-- point.
byte1 :: Char -> Word8
-- | Extract byte 2 of a UTF-8 code point.
byte2 :: Char -> Word8
-- | Extract byte 3 of a UTF-8 code point.
byte3 :: Char -> Word8