on master help sign in
Idris-dev/test/basic021/basic021_2.idr
13 lines 276 B history raw
1import Data.IORef
3count : HasReference ffi => Nat -> IORef Integer -> IO' ffi ()
4count Z ref
5 = do x <- readIORef' ref
6 printLn' x
7count (S k) ref
8 = do modifyIORef' ref (+1)
9 count k ref
11main : IO ()
12main = do r <- newIORef' 0
13 count 1000 r