# Step 100

RETFUN

### Stack and Code

StackExpression
 `upd * \$12` `(* realWorld)` `case * {(# new_s, result #) -> \$0_? new_s}` `upd * main`
`thenIO_? \$15 \$16`

### Heap

 Variable Object `\$0` `PAP(thenIO \$1 \$0)` `\$1` `PAP(thenIO \$3 \$4)` `\$11` `PAP(returnIO unit)` `\$12` `BLACKHOLE` `\$15` `THUNK(return_1 monadIO unit)` `\$16` `THUNK(poll_1 monadIO)` `\$3` `PAP(returnIO unit)` `\$4` `PAP(thenIO \$7 \$8)` `\$7` `PAP(returnIO unit)` `\$8` `PAP(thenIO \$11 \$12)` `main` `BLACKHOLE` `monadIO` `CON(Monad returnIO thenIO)` `poll` ```FUN(monad -> let { ret_thunk = THUNK(return_1 monad unit); poll_poll_thunk = THUNK(poll_1 monad) } in then_1 monad ret_thunk poll_poll_thunk)``` `realWorld` `CON(RealWorld)` `return` ```FUN(monad -> case monad of { Monad return then -> return })``` `returnIO` `FUN(x s -> (# s, x #))` `then` ```FUN(monad -> case monad of { Monad return then -> then })``` `thenIO` ```FUN(m k s -> case m_? s of { (# new_s, result #) -> k_? new_s })``` `unit` `CON(Unit)`