iteratee [PATCH] Data.Iteratee.IO.Interact

Conrad Parker conrad at metadecks.org
Tue Aug 24 20:22:15 EDT 2010


The attached patch to iteratee-0.3 adds an iteratee for IO
interaction, which has been tested with both a text command loop
(using editline) and a GTK gui. From the docs:

Use an IO function to choose what iteratee to run. Typically this
function handles user interaction and returns with a simple iteratee
such as 'head' or 'seek'.

The IO function takes a value of type 'a' as input, and should return
'Right a' to continue, or 'Left b' to terminate. Upon termination,
ioIter will return 'Done b'.

The second argument to 'ioIter' is used as the initial input to the IO
function, and on each successive iteration the previously returned
value is used as input. Put another way, the value of type 'a' is used
like a fold accumulator.  The value of type 'b' is typically some form
of control code that the application uses to signal the reason for
termination.

cheers,

Conrad.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-data_iteratee_io_interact.dpatch
Type: application/octet-stream
Size: 2173 bytes
Desc: not available
Url : http://projects.haskell.org/pipermail/iteratee/attachments/20100825/e937251a/attachment.obj 


More information about the Iteratee mailing list