Skip to content

Alternative approaches #2

@pete-murphy

Description

@pete-murphy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions