streamly icon indicating copy to clipboard operation
streamly copied to clipboard

Consider changing signatures of some parsers that use a fold for collecting output

Open harendra-kumar opened this issue 3 years ago • 2 comments

For example:

many :: MonadCatch m => Parser m a b -> Fold m b c -> Parser m a c

Can be changed to:

many :: MonadCatch m => Fold m b c -> Parser m a b -> Parser m a c

That the fold can be used to curry the function to get a signature that is more like the standard many function.

harendra-kumar avatar May 03 '22 16:05 harendra-kumar

We had a discussion on this and decided to follow the former styles i.e.:

many ::  Parser m a b -> Fold m b c -> Parser m a c

The reason is that the tail of the signature expresses a transformation similar to stream -> stream transformation operations. Here we are transforming the input of the Fold, returning a parser.

harendra-kumar avatar Sep 19 '22 18:09 harendra-kumar

We need to change all the folds and parsers to follow this style.

harendra-kumar avatar Sep 19 '22 18:09 harendra-kumar