diff options
Diffstat (limited to 'testsuite/tests/safeHaskell/unsafeLibs/Dep02.hs')
-rw-r--r-- | testsuite/tests/safeHaskell/unsafeLibs/Dep02.hs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/testsuite/tests/safeHaskell/unsafeLibs/Dep02.hs b/testsuite/tests/safeHaskell/unsafeLibs/Dep02.hs new file mode 100644 index 0000000000..f9dbb26064 --- /dev/null +++ b/testsuite/tests/safeHaskell/unsafeLibs/Dep02.hs @@ -0,0 +1,16 @@ +module Dep02 where + +import Control.Monad +import Control.Monad.ST.Lazy +import Data.STRef.Lazy + +sumST :: Num a => [a] -> a +sumST xs = runST $ do + n <- newSTRef 0 + forM_ xs $ \x -> do + modifySTRef n (+x) + readSTRef n + +badST :: () +badST = runST $ unsafeIOToST $ putStrLn "Hello World" + |