iteratee [] suggestion for mapStreamM

John Lato jwlato at gmail.com
Wed Aug 25 18:09:31 EDT 2010


Dear Ben,

My apologies for this.  I've added a note and pushed a new version.

John

On Wed, Aug 25, 2010 at 10:59 PM, Ben <midfield at gmail.com> wrote:

> Hi --
>
> I see you have distributed the unfinished tutorial.  That is fine, but
> please put a note on it saying it is not finished in the next release
> (hopefully I will finish it before the next release so this will be
> unnecessary!)
>
> I haven't had time to edit it for wiki publication, but I will try to
> get to that sometime.
>
> Best, Ben Lee
>
> On Mon, Aug 23, 2010 at 11:24 AM, John Lato <jwlato at gmail.com> wrote:
> > Hi Ben,
> >
> > Thanks very much for submitting this; it looks very good.  I'm sure it
> will
> > be helpful.  I could distribute this with the package if you like, but
> > perhaps you might want to put some of this on the wiki?  I think it would
> > reach more viewers then.
> >
> > Sincerely,
> > John
> >
> > On Mon, Aug 23, 2010 at 6:36 PM, Ben <midfield at gmail.com> wrote:
> >>
> >> i have been unable to finish my iteratee tutorial due to my job being
> >> crazy right now.  i might be able to get back to it at a later date,
> >> but with the advent of the new simplified iteratee library, i thought
> >> it might be useful to have in this unfinished form, because the most
> >> finished part is about CPS-style versus ADT style.  it might be useful
> >> to cut out (it's at the end, under the CPS heading) to help teach
> >> people how to convert their old-style iteratee code into CPS style.
> >>
> >> best, b
> >>
> >> On Mon, Aug 16, 2010 at 8:10 AM, John Lato <jwlato at gmail.com> wrote:
> >> > On Sun, Aug 15, 2010 at 1:20 AM, Ben <midfield at gmail.com> wrote:
> >> >>
> >> >> A suggestion for Data.Iteratee.ListLike :
> >> >>
> >> >> mapStreamM :: (Monad m) =>
> >> >>  (el -> m el')
> >> >>  -> Enumeratee [el] [el'] m a
> >> >> mapStreamM mf = eneeCheckIfDone (liftI . step)
> >> >>  where
> >> >>    step k (Chunk xs)
> >> >>      | LL.null xs = liftI (step k)
> >> >>      | otherwise  = joinIM $ do ys <- mapM mf xs
> >> >>                                 return $ mapStreamM mf $ k (Chunk ys)
> >> >>    step k s       = idone (liftI k) s
> >> >>
> >> >> an improvement would be something that actually uses the ListLike
> >> >> class (or some monadic extension of it.)
> >> >
> >> > Thanks for this suggestion; I think it would be useful.
> >> > This gets to a related issue I've been struggling with for some time.
>  I
> >> > would like for iteratee to support using mutable buffers.  I believe
> >> > this
> >> > could be very efficient as it would completely bypass a large amount
> of
> >> > allocation/gc work.  There are two primary issues I have so far:
> >> > 1)  I don't know how to make them 100% compatible with standard
> >> > iteratees
> >> > because the Monad instance needs to be slightly different.  In my test
> >> > implementation I use a newtype of Iteratee, which is mostly
> >> > satisfactory.
> >> > 2) Everything in ListLike needs to be re-written for a monadic
> version.
> >> >  ListLike itself is not widely used, but for mutable buffers there's
> >> > even
> >> > more disparity.  At least ListLike instances for Vector, Text, etc.
> can
> >> > be
> >> > written relatively mechanically.
> >> > Is there any interest in further developments in this direction?
> >> > John
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.haskell.org/pipermail/iteratee/attachments/20100825/21479ecc/attachment.htm 


More information about the Iteratee mailing list