It's been pointed out that Fold is isomorphic to a Moore machine, and there's a purescript-folds package that doesn't use the existential type. According to Nate Faubion:
Note that Fold can admit more fusion simply because you can step multiple times without calling (x -> b), and maps can be fused. It essentially embeds coyoneda. Moore requires you to apply it at every step.
I still haven't digested that—does it mean the encoding using the existential type (this one as opposed to that in purescript-folds) is more efficient somehow?
Further reading:
Kmett on Moore & transducers: https://www.schoolofhaskell.com/user/edwardk/moore/for-less
Alternative fold libraries (since I don't know where else to track these):
https://github.com/metrix-ai/deferred-folds
https://github.com/effectfully/prefolds
https://github.com/ekmett/folds
It's been pointed out that
Foldis isomorphic to a Moore machine, and there's apurescript-foldspackage that doesn't use the existential type. According to Nate Faubion:I still haven't digested that—does it mean the encoding using the existential type (this one as opposed to that in
purescript-folds) is more efficient somehow?Further reading:
Kmett on
Moore& transducers: https://www.schoolofhaskell.com/user/edwardk/moore/for-lessAlternative fold libraries (since I don't know where else to track these):
https://github.com/metrix-ai/deferred-folds
https://github.com/effectfully/prefolds
https://github.com/ekmett/folds