on master help sign in
Idris-dev/test/basic022/basic022.idr
13 lines 279 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 : JS_IO ()
12main = do r <- newIORef' 0
13 count 1000 r