blob: e19374355378e0fec9a1581a06434df693e93147 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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
|