You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feel free to discuss ideas, techniques, compiler technology, or just to say hi!
Compiler tech is my first issue, yes, the code can be more efficiently implemented in terms of trampolines, but its much more
work, and the compiler should be smart enough to know when code is in the CMC, and it can apply optimsations, since intermediary results are inaccessible. The CCC assumes every state is cloneable, which introduces copying. Obviously both cases involve code transformations to a trampoline, for O(1) stack growth. Without it, the beautiful simplicity of the IO monad is purely aesthetic, in all but non-recursive environments (the easy route for compiler writers).
To obtain ultimate performance requires a jump instruction, so none of C,C++ or wasm make ideal targets for this type of code. A good old fashioned jump is needed. However, trampolines can be used in all of these languages, and my own research shows extremely good performance from C++, treated as a high level assembler for a higher level abstraction of it, capable of performing the required transformations.
If it's possible for a single programmer to do this, how come there are essentially no languages out there that do it? The only reason I can think of is that most programming languages provide apis for various components, strings, IO, objects, interfaces, Promises, exceptions. Haskell is an exception to this, but it doesn't really seem practical to code in. For a functional language, it doesn't look very much like the lambda calculus! But its founding functors are very cleverly constructed. The do notation doesn't read naturally, and it is strangely dependent on a pre processor less powerful than itself.
The text was updated successfully, but these errors were encountered:
Welcome to IO-Monad chat.
Feel free to discuss ideas, techniques, compiler technology, or just to say hi!
Compiler tech is my first issue, yes, the code can be more efficiently implemented in terms of trampolines, but its much more
work, and the compiler should be smart enough to know when code is in the
CMC
, and it can apply optimsations, since intermediary results are inaccessible. TheCCC
assumes every state is cloneable, which introduces copying. Obviously both cases involve code transformations to a trampoline, for O(1) stack growth. Without it, the beautiful simplicity of the IO monad is purely aesthetic, in all but non-recursive environments (the easy route for compiler writers).To obtain ultimate performance requires a jump instruction, so none of
C
,C++
orwasm
make ideal targets for this type of code. A good old fashioned jump is needed. However, trampolines can be used in all of these languages, and my own research shows extremely good performance fromC++
, treated as a high level assembler for a higher level abstraction of it, capable of performing the required transformations.If it's possible for a single programmer to do this, how come there are essentially no languages out there that do it? The only reason I can think of is that most programming languages provide apis for various components, strings, IO, objects, interfaces, Promises, exceptions. Haskell is an exception to this, but it doesn't really seem practical to code in. For a functional language, it doesn't look very much like the lambda calculus! But its founding functors are very cleverly constructed. The do notation doesn't read naturally, and it is strangely dependent on a pre processor less powerful than itself.
The text was updated successfully, but these errors were encountered: