Safe Haskell | None |
---|---|
Language | GHC2021 |
Synopsis
- type Bytes = ByteString
- type AsText (enc :: k) = Refined enc Text
- class Encode (enc :: k) where
- class Decode (enc :: k) where
- decodeText :: forall {k} (enc :: k) e. (e -> String) -> (Bytes -> Either e Text) -> Bytes -> Either String (AsText enc)
- wrapUnsafeDecoder :: (Bytes -> Text) -> Bytes -> Either UnicodeException Text
Documentation
type Bytes = ByteString Source #
class Encode (enc :: k) where Source #
Bytestring encoders for text validated for a given encoding.
class Decode (enc :: k) where Source #
decode :: Bytes -> Either String (AsText enc) Source #
Decode a ByteString
to Text
with an explicit encoding.
This is intended to be used with visible type applications.
decodeText :: forall {k} (enc :: k) e. (e -> String) -> (Bytes -> Either e Text) -> Bytes -> Either String (AsText enc) Source #
wrapUnsafeDecoder :: (Bytes -> Text) -> Bytes -> Either UnicodeException Text Source #
Run an unsafe decoder safely.
Copied from Data.Text.Encoding.decodeUtf8'
, so should be bulletproof?