I need to decode ByteStrings from various encodings into Text, but the ByteStrings might be incomplete fragments. Ideally, I would need a function with signature of something like:
decodeFragment :: Encoding -> ByteString -> (Text, ByteString)
which returnes the succesfully decoded Text as well as any remaining bytes that didn't form a complete unicode character (so I can re-use those bytes when I get the next fragment).
Does this sort of function already exist in some Haskell library, or do I need to roll my own? For now, I could even get started with something that doesn't support encodings beyond UTF-8.