Proposal: Applicative => Monad: Call for consensus

Tyson Whitehead twhitehead at gmail.com
Tue Jan 18 04:36:11 CET 2011


On January 17, 2011 19:24:12 Jan-Willem Maessen wrote:
> > join (CPS f) = CPS $ \k -> unCPS (f id) k
> 
<snip>
> 
> Using these definitions, and join = (>>= id), we obtain:
> 
> join (CPS cca) = CPS (\k -> cca (\ca -> unCPS ca k))

That is the same.  The key is that the final computation here is unCPS ca k.  
Delaying the application of k (returning unCPS ca and then applying k gives 
the same result as directly applying unCPS ca k and returning it) we get

join (CPS cca) = CPS (\k -> cca (\ca -> unCPS ca k))
join (CPS cca) = CPS (\k -> cca (\ca -> unCPS ca) k)

Now, delaying the transformation by unCPS (returning ca and then forming unCPS 
ca gives the same result as directly forming unCPS ca and returning it) we get

join (CPS cca) = CPS (\k -> unCPS (cca (\ca -> ca)) k)
join (CPS cca) = CPS (\k -> unCPS (cca id) k)

which brings us back to the above.

Cheers!  -Tyson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://www.haskell.org/pipermail/libraries/attachments/20110117/66194500/attachment.pgp>


More information about the Libraries mailing list