User loginNavigation |
archivesHaxl(-like "Monads") in terms of Delimited Continuations?Haxl allows for IO operations to be batched by having Applicative operators that result in a "slightly unlawful" Monad instance -- rather than strictly having I'm wondering if it's possible to implement something similar in a language that implements effects in terms of delimited continuations rather than in terms of monads. It seems a lot less obvious how to do so, at least; when evaluating the arguments of an applicative-shaped function call (pure function, effectful arguments), the effect handler must process them one by one, and can't introspect on the continuation to see what future effects might be performed. An unfortunate solution might be to have a domain-specific optimization pass, reliant on inlining and other optimizations, that notes an effect as having some "do these in parallel" operator and transforms a program that unconditionally performs multiple effects in sequence to a single effect that uses that operator. However, this is terribly unsatisfying, since it's a non-semantics-preserving optimization, rather than something that falls directly out of the user-written code. By Nathan Ringo at 2023-12-27 00:22 | LtU Forum | login or register to post comments | other blogs | 2785 reads
|
Browse archivesActive forum topics |
Recent comments
23 weeks 5 days ago
23 weeks 5 days ago
23 weeks 5 days ago
46 weeks 30 min ago
50 weeks 1 day ago
51 weeks 6 days ago
51 weeks 6 days ago
1 year 2 weeks ago
1 year 7 weeks ago
1 year 7 weeks ago