User loginNavigation |
Co-continuations: a dual to shift/reset?Shift/reset allow convenient expression of monadic computations, as a kind of generalized, functional version of do-notation. From the beginning of that link:
The obvious question is whether there is an analogous construct for comonads. Given that there is a codo-notation I believe there is. In a concatenative language, shift/reset can be written as:
The F block observes the future of the computation (delimited by the nearest reset) and may select a new one. I believe the comonadic dual is:
The F block observes the past of the computation (delimited by the nearest coreset) and may select a new one. This leads to a combined operator:
The F block observes the future and past of the computation (delimited by the nearest braces) and may select new ones. This is first class (co)control flow. I want to say something like "the dual of continuations is environments", as "environment" is an existing concept that seems conceptually close to "store". Note that on this page, someone posts functions analogous to shift/reset for "codensity" or "store".
I believe this notation allows the convenient expression of arrows (and monads and comonads) in the same way shift/reset allows expression of monads. Arrows allow decoration of both inputs and outputs, as opposed to only inputs for comonads and only outputs for monads. This makes sense to me but I'm not totally sure since there's not much information on comonads/codo notation and such. I'd appreciate any comments. EDIT: I think the correct format is actually
By xkapastel at 2018-10-07 15:05 | LtU Forum | previous forum topic | next forum topic | other blogs | 3590 reads
|
Browse archives
Active forum topics |
Recent comments
28 weeks 57 min ago
28 weeks 4 hours ago
28 weeks 4 hours ago
50 weeks 1 day ago
1 year 2 weeks ago
1 year 3 weeks ago
1 year 3 weeks ago
1 year 6 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago