[Haskell-cafe] A home-brew iteration-alike library: some extension quiestions

Permjacov Evgeniy permeakra at gmail.com
Mon Dec 13 10:30:36 CET 2010


Well, It looks like with 'transformer' look onto iteratees it is
possible to fold two streams without anything except Iteratee, yet some
complications arise. Even real zipping. for example merging two sorted
streams with output stream sorted, is expressible. More preciesely, I
tried to write a separate module (attached) and with careful use of
'runners' I got stack of Iteratee/Enumeratee transformers, that shall do
the job. However, typing of the running function and input streams is a
mess:

t \i e g -> mkEnumeration $ enumerateTo g $ mkIteration $ enumerateTo e
(mkIteration i)
\i e g -> mkEnumeration $ enumerateTo g $ mkIteration $ enumerateTo e
(mkIteration i)
  :: Iteratee e2 a s2 (Iteratee e1 a s1 (Enumeratee e r s m)) a
     -> Enumeration e2 a s2 (Iteratee e1 a s1 (Enumeratee e r s m))
     -> Enumeration e1 a s1 (Enumeratee e r s m)
     -> Enumeration e r s m

And lifting of innermost iteratee's 'nextIM' is not sufficient for merge
of sorting streams: A separate one must be written.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Types.hs
Type: text/x-haskell
Size: 3018 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20101213/0130f006/attachment-0001.hs>


More information about the Haskell-Cafe mailing list