Sat Jul 16 12:20:13 CEST 2011
Lifting to CPS computations
Why do i need to lift to (a -> M b) and not (M a -> M b)?
cps1 f a = CPS (\k -> k (f a))
cps2 f a b = CPS (\k -> k (f a b))
The thing is that these are really just return.
What I find strange is that this seems so "easy". I.e. instead of
f1 a b = do
sa <- sinCPS a
sb <- sinCPS b
mulCPS sa sb
why not do
f1 a b = return ((sin a) * (sin b))
The thing is that this monad does not allow room for tracking the data
flow. I have a CPS monad but I'm not using it yet for what I intend =
to construct a SSA node list. Then of course (different monad!) these
two forms are not equivalent.
The rule should be:
1. only use "blessed" lifted ops
2. do not pass result of nested computations to return