Remix.run Logo
kccqzy a day ago

ApplicativeDo can be thought of as a compile-time transformation that turns sequential code into possibly parallel* code just by analyzing the way variables are used. Once I've had that realization I really appreciated it more.

*: By "possibly parallel" I mean the blocks of code are known to be independent from each other. They could be actually executed in parallel if the Applicative instance does so.

ambicapter a day ago | parent [-]

Does that mean it may or may not run the code in parallel once compiled? Doesn't seem very ergonomic to the developer if true.

kccqzy a day ago | parent [-]

Why isn't it ergonomic? You just read the documentation or source for the Applicative class in question to find out.

If the Applicative class chooses to decide randomly whether to run in parallel, that's the class's fault, not the language or the compiler's problem.