From 75ba6aeef88df2f051b73aa916fb66ce4c6b8a14 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Wed, 1 Jul 2026 22:48:53 +0100 Subject: Initial --- test/Main.hs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/Main.hs (limited to 'test/Main.hs') 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 -- cgit v1.3.1