Re:I Believe Zig Has Function Colors
by inglor on Saturday April 09, 2022 @07:37AM
(#30967139)
`yield` is just syntactic sugar for the two-way generator communication protocol where the consumer calls `.next(value)` which returns a value in turn. This is as expressive and you can build `do` semantics on top of stuff like lists/either/state/io on top of it. No AST parsing needed.
[ Parent
| on HN ]
And do syntax sugar is just nested calls of `bind` which is a function of the Monad trait. Lists are also a Monad, so do notation just works right now with lists, either, state everything in Haskell.
I really don’t get how is Haskell “behind”.