zlacker

[parent] [thread] 0 comments
1. anon29+(OP)[view] [source] 2024-01-20 02:57:07
The main issue with async/sync differentiation in all languages is that all languages have a blessed category / monad in which they execute, and the async support (or whatever other execution schemes) are 'bolted on'. Haskell makes this clear in its type system, and while the monadic functions are much more generalizable than async/await (which seems to be the one monad every other language wants to implement for some reason), they're also not 'complete'... there are functions in the prelude with obvious monadic equivalents that are not part of the prelude. Nevertheless, even if they were, you cannot interchange them with the blessed 'pure' monad (equivalent to the Identity newtype), which is the Kleisli monad of the Hask category.

There has been work to enable generic compilation of all Haskell code to arbitrary categories (see Conal Elliot's compiling with categories) but unfortunately the approach has not caught on.

It would actually be an interesting design space to support arbitrary categories as a basic design principle of a novel programming language. Obviously at some level something would need to be the 'special' one that can be compiled to machine code, but if the complexity could be hidden / abstracted that would indeed be interesting.

[go to top]