Open diasbruno opened 4 years ago
Unless I'm mistaken, pipe
already handles this kind of composition, but in an unrestricted fashion, i.e. you can compose many parsers and only invoke the transformation function if all of them succeed. Nothing prevents you from using pipe
with just a single parser though as an equivalent to what bind
does here.
I'm not opposed to merging this as-is, but I'm wondering if you think there is a benefit to having both functions if they essentially overlap 1:1 in functionality?
I didn't know pipe implemented this functionality. Maybe because bind
is a common name for this, but if it does the job, we can close this.
Thanks!
I'll try to have a look on the docs and see if we add something there.
I looked at pipe
and the only difference I can see is that it uses some arrays and a reverse...I don't know if it would be a good idea, but maybe we could implement pipe using bind
and maybe remove the intermediary arrays of pipe. Any thoughts?
Closes #45