Skip to content

Desugar do-notation into Applicative operations (ApplicativeDo) #2435

@zudov

Description

@zudov

The paper describes many details and all that is easily mapped to purescript.

Essentially the process of desugaring is about splitting the do-notation statements into subsequences (parallel blocks) in such a way that the blocks don't share any binders. Those parallel blocks are then combined with map, apply and join.

That allows to make use of all the applicative benefits while still being able to use do-notation sugar.

It comes at cost of making do-notation desugaring much harder for understanding, though you could still use the simple bind desugaring as a mental model until you need to know more.

This would cause some breaking changes too:

  • the imports of map and apply would have to be added in relevant places;
  • the rebindable syntax trick would get more involved. Previously you could just define the bind, but now you'd have to also define the map and apply;
  • when apply's semantic differs from ap's the meaning of a program might get changed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions