Text I/O library proposal, first draft

Ashley Yakeley ashley@semantic.org
Tue, 05 Aug 2003 18:01:21 -0700


In article <200308050848.BAA15295@mail4.halcyon.com>, I wrote:

> Actually, if one makes certain assumptions about encodings, you could 
> get away with something like this:
> 
>   type Encoder base t = t -> [base]
>   type Decoder base t = forall m. (Monad m) => m base -> m t
> 
> Is this any less efficient? Probably not if you're writing your 
> BlockRecoders in Haskell.

OK, for something a bit faster for coders written in C, how about:

   type Encoder base t = UArray Int t -> UArray Int base;

   data Decoder base t = forall s. MkDecoder
     (UArray Int base -> Maybe s -> (s,UArray Int t));

-- 
Ashley Yakeley, Seattle WA