diff options
Diffstat (limited to 'testsuite/tests/simplCore/should_compile/T22347a.hs')
-rw-r--r-- | testsuite/tests/simplCore/should_compile/T22347a.hs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T22347a.hs b/testsuite/tests/simplCore/should_compile/T22347a.hs new file mode 100644 index 0000000000..727eedf8db --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T22347a.hs @@ -0,0 +1,20 @@ +{-# LANGUAGE ScopedTypeVariables #-} +module M where + +import Control.Monad.ST +import Data.Array.ST +import Data.Array.Unboxed + +bfs :: Array Int [Int] -> ST s (STArray s Int ()) +bfs g = do + vis :: STArray s Int () <- newArray (bounds g) () + ch :: STArray s Int () <- newArray (bounds g) () + let go [] = pure () :: ST s () + go q = do + flip mapM_ q $ \u -> do + readArray vis (head (g!u)) + readArray ch u + writeArray ch u () + go [] + go [] + pure ch |