[Haskell-i18n] SourceForge Project Active
Ashley Yakeley
ashley@semantic.org
Mon, 2 Sep 2002 17:06:51 -0700
At 2002-09-02 16:06, Sven Moritz Hallberg wrote:
>Pretty much! I have:
>
>encodeOne :: Char -> [Word8] -- encodeChar is probably prettier
>encode :: String -> [Word8] -- encodeString? I don't care.
>decodeOne :: [Word8] -> (Either Error Char, Int, [Word8])
> -- 2nd. component: number of bytes consumed,
> -- 3rd. component: rest of bytes
>decode :: [Word8] -> (String, [(Error,Int)])
> -- 2nd. component: list of errors and their index in the byte stream
> -- Maybe we should reverse the order of error/index
> -- so it looks like any association list?
>
>Comments welcome.
Cool. You should include a monadic stream transformer e.g.
decodeStream :: (Monad m) => m Word8 -> m (Either Error Char)
or perhaps
decodeStream :: (MonadError Error m) => m (Maybe Word8) -> m (Maybe
Char)
I use (m (Maybe a)) for streams that have an end e.g. files and network
connections.
--
Ashley Yakeley, Seattle WA