`[<<][meta][>>][..]`
Sat Jul 16 10:43:38 CEST 2011

```I'm trying to record my aha here.  Starting from understanding the
basic idea behind the CPS monad (see previous post) I started writing
down some computations.  Forgive my half-assed terminology but this is
an important relaxation in my head..

I started with the sine function (sin).  The really strange thing here
is that instead of a (CPS a) type popping up, what happens is that an
(a -> CPS a) type pops up very naturally.  I.e. (CPS a) is only the
_result_ of a computation, i.e. a thunk already bound to an input.

What happens is that I first wrote down the wrong type, thinking
"taking the sine of something is a computation"

(WRONG)    sinCPS :: CPS Floating

But that only specifies the _output_:

(WRONG)    sinCPS = CPS(\k -> k (sin <what???>))

The solution to that is of course glaringly obvious:

sinCPS :: Floating -> CPS Floating

sinCPS t = CPS(\k -> k (sin t))

note that here CPS is already partially aplied: the return value
parameter is not important for the monadic mojo.

```
`[Reply][About]`
`[<<][meta][>>][..]`