    module System.Console.Haskeline.Recover where

    import GHC.IO.Encoding
    import GHC.IO.Encoding.Failure

    transliterateFailure :: TextEncoding -> TextEncoding
    transliterateFailure :: TextEncoding -> TextEncoding
    transliterateFailure
      TextEncoding
        { mkTextEncoder :: ()
    mkTextEncoder = IO (TextEncoder estate)
    mkEncoder
        , mkTextDecoder :: ()
    mkTextDecoder = IO (TextDecoder dstate)
    mkDecoder
        , textEncodingName :: TextEncoding -> String
    textEncodingName = String
    name
        } = TextEncoding
              { mkTextDecoder :: IO (TextDecoder dstate)
    mkTextDecoder = (TextDecoder dstate -> TextDecoder dstate)
    -> IO (TextDecoder dstate) -> IO (TextDecoder dstate)
    forall a b. (a -> b) -> IO a -> IO b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap ((Buffer Word8 -> Buffer Char -> IO (Buffer Word8, Buffer Char))
    -> TextDecoder dstate -> TextDecoder dstate
    forall {from} {to} {state}.
    (Buffer from -> Buffer to -> IO (Buffer from, Buffer to))
    -> BufferCodec from to state -> BufferCodec from to state
    setRecover
                                    ((Buffer Word8 -> Buffer Char -> IO (Buffer Word8, Buffer Char))
     -> TextDecoder dstate -> TextDecoder dstate)
    -> (Buffer Word8 -> Buffer Char -> IO (Buffer Word8, Buffer Char))
    -> TextDecoder dstate
    -> TextDecoder dstate
    forall a b. (a -> b) -> a -> b
    $ CodingFailureMode
    -> Buffer Word8 -> Buffer Char -> IO (Buffer Word8, Buffer Char)
    recoverDecode CodingFailureMode
    TransliterateCodingFailure)
                                IO (TextDecoder dstate)
    mkDecoder
              , mkTextEncoder :: IO (TextEncoder estate)
    mkTextEncoder = (TextEncoder estate -> TextEncoder estate)
    -> IO (TextEncoder estate) -> IO (TextEncoder estate)
    forall a b. (a -> b) -> IO a -> IO b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap ((Buffer Char -> Buffer Word8 -> IO (Buffer Char, Buffer Word8))
    -> TextEncoder estate -> TextEncoder estate
    forall {from} {to} {state}.
    (Buffer from -> Buffer to -> IO (Buffer from, Buffer to))
    -> BufferCodec from to state -> BufferCodec from to state
    setRecover
                                    ((Buffer Char -> Buffer Word8 -> IO (Buffer Char, Buffer Word8))
     -> TextEncoder estate -> TextEncoder estate)
    -> (Buffer Char -> Buffer Word8 -> IO (Buffer Char, Buffer Word8))
    -> TextEncoder estate
    -> TextEncoder estate
    forall a b. (a -> b) -> a -> b
    $ CodingFailureMode
    -> Buffer Char -> Buffer Word8 -> IO (Buffer Char, Buffer Word8)
    recoverEncode CodingFailureMode
    TransliterateCodingFailure)
                                IO (TextEncoder estate)
    mkEncoder
              , textEncodingName :: String
    textEncodingName = String
    name
              }
      where
        setRecover :: (Buffer from -> Buffer to -> IO (Buffer from, Buffer to))
    -> BufferCodec from to state -> BufferCodec from to state
    setRecover Buffer from -> Buffer to -> IO (Buffer from, Buffer to)
    r BufferCodec from to state
    x = BufferCodec from to state
    x { recover = r }