Idris2/tests/node/node003/IORef.idr

17 lines
332 B
Idris
Raw Normal View History

2020-06-12 23:35:08 +03:00
import Data.IORef
main : IO ()
main
= do x <- newIORef 42
let y = x
writeIORef y 94
val <- readIORef x
printLn val
val <- readIORef y
printLn val
modifyIORef x (* 2)
val <- readIORef x
printLn val
val <- readIORef y
printLn val