>>> runPureEff $ withState 10 $ \st -> do n <- get st pure (s -> (2 * n, s)) (20,10)
>>> runPureEff $ withState 10 $ \st -> do n <- get st pure (s -> (2 * n, s)) (20,10)
withStateT f m = modify f >> m
withStateT f m = modify f >> m
runPureEff $ withStateSource $ \source -> do n <- newState source 5 total <- newState source 0 withJump $ \done -> forever $ do n' <- get n modify total (+ n') when (n' == 0) $ jumpTo done modify n (subtract 1) get total 15
runPureEff $ withStateSource $ \source -> do n <- newState source 5 total <- newState source 0 withJump $ \done -> forever $ do n' <- get n modify total (+ n') when (n' == 0) $ jumpTo done modify n (subtract 1) get total 15