Open shlok opened 2 years ago
Yes, it will be exposed at some point. We have not done it yet because the design of folds and parsers has been in flux and there are several important issues/aspects that are to be resolved which may have some impact on the Fold type.
Once the design stabilizes we would expect users to write their own folds as well either using the constructor directly or we will have smart constructors that will allow you to have equivalent power. See https://hackage.haskell.org/package/streamly-0.8.0/docs/Streamly-Internal-Data-Fold.html#g:2 for smart constructors that we use internally, some of these are already exposed, others may be exposed in future. I suggest you use these in your code.
In addition to folds, users should also be able to write their own parsers, unfolds, streaming combinators so those constructors will also be exposed at some point. When most design aspects are stable and we expect not many disrutpive changes to the types or the way they are supposed to be used.
From: https://hackage.haskell.org/package/streamly-0.8.0/docs/Streamly-Data-Fold.html
Just to confirm, is your plan actually to expose it at some point?
I suggest this indeed be done. I have in my codebase a
Fold
that is created on top of anotherFold
. This is done using a pattern match on the latter, exactly like you are already doing internally in the streamly codebase to implement many of theFold
functions (e.g.,lmap
, to name one of countless).