Created
August 19, 2011 05:58
-
-
Save imccoy/1156150 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
-- playing with the adaptive library. | |
import Control.Monad.Adaptive | |
printMod mod = do | |
r <- inCh $ readMod mod | |
inM (putStrLn $ show r) | |
main = run $ do | |
i1 <- newMod (return (2 :: Integer)) | |
i2 <- newMod (return 3) | |
r <- newMod $ do | |
i1' <- readMod i1 | |
i2' <- readMod i2 | |
return (i1' + i2') | |
printMod r | |
change i2 5 | |
propagate | |
printMod r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment