by quickthrower2 · 5y ago · 0 comments
p = newPerson();
w = walk(p);
t = talk(p, w);
s = shout(p, t);
becomes, seq(shout, seq(talk, seq(walk, seq(newPerson())))
"infix", newPerson() seq
walk seq
talk seq
shout
The operations `newPerson` and `seq` form a monad.If you can omit `w =`, `t=`, and `s=` you have an applicative, rather than a monad. Ie., the operations being sequenced are independent.