Created
June 14, 2018 20:16
-
-
Save jjant/8a4bd445cff29fde6fd19221c8c385df to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
k0Plusk15 = \k -> k 0 + k 15 | |
myCont = Cont k0Plusk15 -- Extracted the function for ease of notation later below. | |
myCont2 = myCont >>= (\x -> return (x * 2)) | |
= (Cont k0Plusk15) >>= (\x -> Cont ($ (x * 2))) | |
= Cont $ \k' -> k0Plusk15 (\x -> runCont (Cont ($ (x * 2))) k') | |
= Cont $ \k' -> k0Plusk15 (\x -> ($ (x * 2)) k') | |
= Cont $ \k' -> k0Plusk15 (\x -> k' (x * 2)) | |
= Cont $ \k' -> k0Plusk15 (\x -> k' (x * 2)) | |
= Cont $ \k' -> (\k -> k 0 + k 15) (\x -> k' (x * 2)) | |
= Cont $ \k' -> (\x -> k' (x * 2)) 0 + (\x -> k' (x * 2)) 15 | |
= Cont $ \k' -> k' (0 * 2) + k' (15 * 2) | |
= Cont $ \k' -> k' 0 + k' 30 -- Ah-ha! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment