Currently there are no new features added to yeti, however once this is over here is a proposal to add syntactic sugar for monad bind similar to Hasekll's do notation.
The attached code rewrites to bind operations node-sequences (Seq):
( f = doFoo();
g <- monadValue; //here starts the rewrite
x = return (g + 1);
mon.h <- x;
return h);
is rewritten to:
(f = doFoo();
bind do g:
x = return (g + 1);
mon.bind do h:
return h;
done
x;
done
monadValue);
The 'bind' function has to be in scope. If the node left to the (<-) is a symbol a plain 'bind' is referenced, if the node left to (<-) is a FieldOp than the left part is evaluted to be a structure for the 'bind' function. This is useful to have different 'bind' functions (ie through named load). The 'field-name' becomes the argument name in the lambda.
The (<-) is only considered for rewrite if it is a direkt child of the squence and the left node ist either a symbol or a field-reference. The lambda always than extends to the end of the sequenze (the subsequence is recusively transformed).
Currently there are no new features added to yeti, however once this is over here is a proposal to add syntactic sugar for monad bind similar to Hasekll's do notation.
The attached code rewrites to bind operations node-sequences (Seq):
( f = doFoo(); g <- monadValue; //here starts the rewrite x = return (g + 1); mon.h <- x; return h);
is rewritten to:
(f = doFoo(); bind do g: x = return (g + 1); mon.bind do h: return h; done x; done monadValue);
The 'bind' function has to be in scope. If the node left to the (<-) is a symbol a plain 'bind' is referenced, if the node left to (<-) is a FieldOp than the left part is evaluted to be a structure for the 'bind' function. This is useful to have different 'bind' functions (ie through named load). The 'field-name' becomes the argument name in the lambda.
The (<-) is only considered for rewrite if it is a direkt child of the squence and the left node ist either a symbol or a field-reference. The lambda always than extends to the end of the sequenze (the subsequence is recusively transformed).