Copyright | (c) Daniel Mendler 2017 |
---|---|
License | MIT |
Maintainer | mail@daniel-mendler.de |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell2010 |
String conversion and decoding
- class ConvertString a b where
- class (ConvertString a b, ConvertString b (Maybe a), ConvertString b (Lenient a)) => EncodeString a b where
- newtype Lenient a = Lenient {
- getLenient :: a
Documentation
class ConvertString a b where Source #
Conversion of strings to other string types
(convertString
:: b -> a) . (convertString
:: a -> b) ≡ (id
:: a -> a) (convertString
:: b ->Maybe
a) . (convertString
:: a -> b) ≡ (Just
:: a ->Maybe
a) (convertString
:: b ->Lenient
a) . (convertString
:: a -> b) ≡ (Lenient
:: a ->Lenient
a)
convertString :: a -> b Source #
Convert a string to another string type
class (ConvertString a b, ConvertString b (Maybe a), ConvertString b (Lenient a)) => EncodeString a b where Source #
Encode and decode strings as a byte sequence
decodeString
.encodeString
≡Just
decodeStringLenient
.encodeString
≡id
encodeString :: a -> b Source #
Encode a string as a byte sequence
decodeStringLenient :: b -> a Source #
Lenient decoding of byte sequence
Lenient means that invalid characters are replaced by the Unicode replacement character '\FFFD'.
decodeString :: b -> Maybe a Source #
Decode byte sequence
If the decoding fails, return Nothing.
Newtype wrapper for a string which was decoded leniently.
Lenient | |
|
Functor Lenient Source # | |
Foldable Lenient Source # | |
Traversable Lenient Source # | |
Generic1 Lenient Source # | |
ConvertString ShortByteString (Lenient String) Source # | |
ConvertString ShortByteString (Lenient Text) Source # | |
ConvertString ShortByteString (Lenient Text) Source # | |
ConvertString ByteString (Lenient String) Source # | |
ConvertString ByteString (Lenient Text) Source # | |
ConvertString ByteString (Lenient Text) Source # | |
ConvertString ByteString (Lenient String) Source # | |
ConvertString ByteString (Lenient Text) Source # | |
ConvertString ByteString (Lenient Text) Source # | |
Eq a => Eq (Lenient a) Source # | |
Ord a => Ord (Lenient a) Source # | |
Read a => Read (Lenient a) Source # | |
Show a => Show (Lenient a) Source # | |
Generic (Lenient a) Source # | |
ConvertString [Word8] (Lenient String) Source # | |
ConvertString [Word8] (Lenient Text) Source # | |
ConvertString [Word8] (Lenient Text) Source # | |
type Rep1 Lenient Source # | |
type Rep (Lenient a) Source # | |