Monad V S Continuation (not finish)

!i have read 1 paper which describe the difference between two method.

Ex: for sequence

int t=foo(5);
if(t) then act1 else act2
  • Continuation passing style: we need to have one more argument which is the function that represents "what to do next".
\act1 -> \act2 -> if t then act1 else act2
    where t = foo 5
  • Monad: the argument is the result of the previous computation.
(foo 5) >>= (\result -> if result then act1 else act2)


Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License