streamly icon indicating copy to clipboard operation
streamly copied to clipboard

Scan and fold type enhancements

Open harendra-kumar opened this issue 6 months ago • 0 comments

We have a few pending problems to solve:

  • #1988
  • #2806
  • #2822
  • #1759
  • #1514

Scan has four operations, fold has the first three of these:

  • initial
  • step
  • final
  • extract

In parsers, we are using separate return types for initial/step/final. We can do the same for scans and folds as well. This will allow us more freedom to loop in Initial and Final states as well. Initial and Final both can have a Continue constructor if required and the driver can call them in a loop. For now we only need looping in Final in case of scans, just like in Parsers. In general, we can even switch between Step and Final, in Step we consume input whereas in Final we just produce without consuming input - this is essentially generalization to the Pipe type.

harendra-kumar avatar Jun 29 '25 18:06 harendra-kumar