Questions tagged [iterate]

Iteratees were introduced by Oleg Kiselyov who maintains a page of articles about the approach, Incremental multi-level input processing and collection enumeration.

Commonly used libraries include:

  • iteratee, based on Oleg's CPS implementation and maintained by John Lato, providing solid support for binary IO, seeking, and parallel processing.
  • enumerator, developed by John Millikin to have a smaller API. This package is commonly used for text and web applications, in projects like snap and yesod.
  • iterIO, David Mazieres' simpler API, with built-in support for HTTP, SSL and compression.
146 questions
446
votes
1 answer

Scalaz iteratees: "Lifting" `EnumeratorT` to match `IterateeT` for a "bigger" monad

If I have an EnumeratorT and a corresponding IterateeT I can run them together: val en: EnumeratorT[String, Task] = EnumeratorT.enumList(List("a", "b", "c")) val it: IterateeT[String, Task, Int] = IterateeT.length (it &= en).run : Task[Int] If the…
lmm
  • 17,076
  • 3
  • 23
  • 37
106
votes
1 answer

Avoiding memory leaks with Scalaz 7 zipWithIndex/group enumeratees

Background As noted in this question, I'm using Scalaz 7 iteratees to process a large (i.e., unbounded) stream of data in constant heap space. My code looks like this: type ErrorOrT[M[+_], A] = EitherT[M, Throwable, A] type ErrorOr[A] = ErrorOrT[IO,…
Aaron Novstrup
  • 20,477
  • 7
  • 67
  • 107
48
votes
1 answer

Using Scalaz Stream for parsing task (replacing Scalaz Iteratees)

Introduction I use Scalaz 7's iteratees in a number of projects, primarily for processing large-ish files. I'd like to start switching to Scalaz streams, which are designed to replace the iteratee package (which frankly is missing a lot of pieces…
Travis Brown
  • 135,682
  • 12
  • 352
  • 654
32
votes
2 answers

Scala streaming library differences (Reactive Streams/Iteratee/RxScala/Scalaz...)

I'm following the Functional Reactive Programming in Scala course on Coursera and we deal with RxScala Observables (based on RxJava). As far as I know, the Play Iteratee's library looks a bit like RxScala Observables, where Observables a bit like…
Sebastien Lorber
  • 79,294
  • 59
  • 260
  • 386
28
votes
4 answers

Play 2.x : Reactive file upload with Iteratees

I will start with the question: How to use Scala API's Iteratee to upload a file to the cloud storage (Azure Blob Storage in my case, but I don't think it's most important now) Background: I need to chunk the input into blocks of about 1 MB for…
biesior
  • 54,554
  • 10
  • 118
  • 177
26
votes
4 answers

Introduction or simple examples for iteratee?

I find Oleg's docs on Iteratee somewhat difficult to get into. Especially since some of the functions in his posts to Haskell-Cafe aren't in the iteratee library (like enum_file). Is there a good introduction to iteratee somewhere, something that…
Magnus
  • 4,444
  • 1
  • 30
  • 47
26
votes
1 answer

Can't understand Iteratee, Enumerator, Enumeratee in Play 2.0

I have just started to learn the Play 2.0 Framework. The one thing I just can't understand is the Iteratee, Enumerator and Enumeratee pattern described in the play tutorial. I have very little experience in functional languages. What does this…
rahul
  • 2,149
  • 3
  • 25
  • 31
19
votes
2 answers

What happens if an Enumerator tries to consume input?

The definition of Enumerator is: type Enumerator a m b = Step a m b -> Iteratee a m b The documentation states that while Iteratees comsume data, Enumerators produce it. I can understand how one might produce data with such a type: enumStream ::…
Joey Adams
  • 37,814
  • 17
  • 79
  • 110
19
votes
1 answer

Haskell iteratee: simple worked example of stripping trailing whitespace

I'm trying to understand how to use the iteratee library with Haskell. All of the articles I've seen so far seem to focus on building an intuition for how iteratees could be built, which is helpful, but now that I want to get down and actually use…
Daniel Lyons
  • 21,545
  • 2
  • 48
  • 73
19
votes
2 answers

What is the connection between Iteratees and FRP?

It seems to me that there is a strong connection between the two ideas. My guess is that FRP could be implemented in terms of Iteratees if there would be a way to express arbitrary graphs with Iteratees. But afaik they only support chain-like…
fho
  • 6,578
  • 19
  • 63
18
votes
1 answer

Forward a file upload stream to S3 through Iteratee with Play2 / Scala

I've read some stuff about the possibility to send a file to S3 through Iteratee, which seems to permit to send so S3 chunks of a file as we receive them and avoid an OutOfMemory for large files for exemple. I've found this SO post which is probably…
Sebastien Lorber
  • 79,294
  • 59
  • 260
  • 386
14
votes
1 answer

How is ReactiveMongo implemented so that it is considered non-blocking?

Reading the documentation about the Play Framework and ReactiveMongo leads me to believe that ReactiveMongo works in such a way that it uses few threads and never blocks. However, it seems that the communication from the Play application to the…
14
votes
2 answers

Iteratees in Scala that use lazy evaluation or fusion?

I have heard that iteratees are lazy, but how lazy exactly are they? Alternatively, can iteratees be fused with a postprocessing function, so that an intermediate data structure does not have to be built? Can I in my iteratee for example build a 1…
Robin Green
  • 29,408
  • 13
  • 94
  • 178
13
votes
2 answers

Do guarded pipes behave the same as pipes using await?

Pipes are a really elegant, really simple version of iteratees. You can write pipe code very easily using the primitives await and yield. Paolo Capriotti extended the concept of pipes with guarded pipes, which uses the slightly more complicated…
Dan Burton
  • 51,332
  • 25
  • 109
  • 190
11
votes
1 answer

Why is `http` in http-enumerator an Iteratee?

The type signature for http is: http :: MonadIO m => Request m -> (W.Status -> W.ResponseHeaders -> Iteratee S.ByteString m a) -> Manager -> Iteratee S.ByteString m a Why isn't it this instead? http :: MonadIO m => … -> m a If…
Joey Adams
  • 37,814
  • 17
  • 79
  • 110
1
2 3
9 10