|encode :: Buffer from -> Buffer to -> IO (Buffer from, Buffer
to)| The encode function translates elements of the buffer from
to the buffer to. It should translate as many elements as
possible given the sizes of the buffers, including translating
zero elements if there is either not enough room in to, or from
does not contain a complete multibyte sequence. encode should
raise an exception if, and only if, from begins with an illegal
sequence, or the first element of from is not representable in
the encoding of to. That is, if any elements can be successfully
translated before an error is encountered, then encode should
translate as much as it can and not throw an exception. This
behaviour is used by the IO library in order to report
translation errors at the point they actually occur, rather than
when the buffer is translated. |getState :: IO state| Return the
current state of the codec. Many codecs are not stateful, and in
these case the state can be represented as '()'. Other codecs
maintain a state. For e