can someone explain to me what does the following continuation do ?foo :: Int -> Cont r String
foo x = callCC $ \k -> do
let y = x ^ 2 + 3
when (y > 20) $ k "over twenty"
return (show $ y - 4)
Specifically, I don't get which of the "k" continuation and the "return" will actually call the current continuation... and what will the other one do?
or an even dumber example:quux :: Cont r Int
quux = callCC $ \k -> do
let n = 5
k n
return 25
what happens? what if I invert k and return?
or can't /g/ into functional programming?
>>55732625
Don't ever use that image again.