diff options
| author | Tom Smeding <tom@tomsmeding.com> | 2026-07-01 23:48:53 +0200 |
|---|---|---|
| committer | Tom Smeding <tom@tomsmeding.com> | 2026-07-01 23:48:53 +0200 |
| commit | 75ba6aeef88df2f051b73aa916fb66ce4c6b8a14 (patch) | |
| tree | b785610b666a0faa518d292f658fce60e2400327 /test | |
Initial
Diffstat (limited to 'test')
| -rw-r--r-- | test/Main.hs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/Main.hs b/test/Main.hs new file mode 100644 index 0000000..0f21a29 --- /dev/null +++ b/test/Main.hs @@ -0,0 +1,19 @@ +{-# LANGUAGE TemplateHaskell #-} +module Main where + +import Data.IORef (IORef, atomicModifyIORef', newIORef) + +import InitOnce + + +globalRef :: IORef Int +globalRef = $$(once [|| newIORef 0 ||]) + +{-# NOINLINE foo #-} +foo :: IO String +foo = atomicModifyIORef' globalRef (\i -> (i + 1, show i)) + +main :: IO () +main = do + putStrLn =<< foo + putStrLn =<< foo |
