summaryrefslogtreecommitdiff
path: root/testsuite/tests/mdo/should_compile/mdo001.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/mdo/should_compile/mdo001.hs')
-rw-r--r--testsuite/tests/mdo/should_compile/mdo001.hs36
1 files changed, 36 insertions, 0 deletions
diff --git a/testsuite/tests/mdo/should_compile/mdo001.hs b/testsuite/tests/mdo/should_compile/mdo001.hs
new file mode 100644
index 0000000000..e193743553
--- /dev/null
+++ b/testsuite/tests/mdo/should_compile/mdo001.hs
@@ -0,0 +1,36 @@
+{-# OPTIONS -XRecursiveDo #-}
+
+-- test that we have all the promised instances
+
+module Main(main) where
+
+import Control.Monad.Fix
+import qualified Control.Monad.ST as SST
+import qualified Control.Monad.ST.Lazy as LST
+
+generic :: MonadFix m => m [Int]
+generic = mdo xs <- return (1:xs)
+ return (take 4 xs)
+
+io :: IO [Int]
+io = generic
+
+sst :: SST.ST s [Int]
+sst = generic
+
+lst :: LST.ST s [Int]
+lst = generic
+
+mb :: Maybe [Int]
+mb = generic
+
+ls :: [[Int]]
+ls = generic
+
+main :: IO ()
+main = do
+ print =<< io
+ print $ SST.runST sst
+ print $ LST.runST lst
+ print $ mb
+ print $ ls