Skip to content

Instantly share code, notes, and snippets.

@imccoy
Created August 19, 2011 05:58
Show Gist options
  • Save imccoy/1156150 to your computer and use it in GitHub Desktop.
Save imccoy/1156150 to your computer and use it in GitHub Desktop.
-- 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