[Haskell-beginners] Continuations

Shishir Srivastava shishir.srivastava at gmail.com
Thu May 28 13:57:22 UTC 2015


Hi,

Reading on continuation I've came across this new style of creating the
functions which I guess is not very clear in how it works

---------------
Prelude> let add_cps x y = \k -> k (x+y)
Prelude> add_cps 3 4 $ print
7
---------------

I have some questions as to
1) what is the role of variable 'k' and what eventually happens to it.
2) How does print work after the $ because there is clearly no parameter
being passed to it.

Thanks,
Shishir Srivastava
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150528/c5379dac/attachment.html>


More information about the Beginners mailing list