3 ms·
Aha! I hadn't realized they'd officially landed already. Yeah, the effects are one of those "really neat" things I was referring to :) I've been thinking abo
by groovy2shoes 10y ago
Aha! I hadn't realized they'd officially landed already. Yeah, the effects are one of those "really neat" things I was referring to :)
I've been thinking about how they could be used with a term-rewriting system for certain kinds of optimization. Some rewrite rules only apply under certain conditions that may or may not be lexically apparent in the absence of an effects system. As a simple example:
rewrite {f map} {g map} compose => {f} {g} compose map ;
This transformation will only work if `f` and `g` are pure functions: if `f` and `g` have side-effects, then the transformation is no longer equivalent. But using the effects system, we can give rewrite rules a sort of context that lets the rewrite system know the extra conditions necessary for a rule to apply.