diff options
author | Thomas Miedema <thomasmiedema@gmail.com> | 2016-06-18 22:44:19 +0200 |
---|---|---|
committer | Thomas Miedema <thomasmiedema@gmail.com> | 2016-06-20 16:22:07 +0200 |
commit | 915e07c33b143126e3c8de1d2ec22ccc709a9a24 (patch) | |
tree | fcde0a7ffc1466b6e53dbee6df835af07e9a7ecc /testsuite/tests/mdo | |
parent | 46ff80f26d1892e1b50e3f10c5d3fded33da6e81 (diff) | |
download | haskell-915e07c33b143126e3c8de1d2ec22ccc709a9a24.tar.gz |
Testsuite: tabs -> spaces [skip ci]
Diffstat (limited to 'testsuite/tests/mdo')
-rw-r--r-- | testsuite/tests/mdo/should_compile/mdo001.hs | 20 | ||||
-rw-r--r-- | testsuite/tests/mdo/should_compile/mdo002.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/mdo/should_compile/mdo004.hs | 6 | ||||
-rw-r--r-- | testsuite/tests/mdo/should_compile/mdo005.hs | 8 | ||||
-rw-r--r-- | testsuite/tests/mdo/should_fail/mdofail005.hs | 2 | ||||
-rw-r--r-- | testsuite/tests/mdo/should_run/mdorun001.hs | 34 |
6 files changed, 37 insertions, 37 deletions
diff --git a/testsuite/tests/mdo/should_compile/mdo001.hs b/testsuite/tests/mdo/should_compile/mdo001.hs index e193743553..576a7d0e90 100644 --- a/testsuite/tests/mdo/should_compile/mdo001.hs +++ b/testsuite/tests/mdo/should_compile/mdo001.hs @@ -3,14 +3,14 @@ -- test that we have all the promised instances module Main(main) where - -import Control.Monad.Fix + +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) + return (take 4 xs) io :: IO [Int] io = generic @@ -20,7 +20,7 @@ sst = generic lst :: LST.ST s [Int] lst = generic - + mb :: Maybe [Int] mb = generic @@ -28,9 +28,9 @@ ls :: [[Int]] ls = generic main :: IO () -main = do - print =<< io - print $ SST.runST sst - print $ LST.runST lst - print $ mb - print $ ls +main = do + print =<< io + print $ SST.runST sst + print $ LST.runST lst + print $ mb + print $ ls diff --git a/testsuite/tests/mdo/should_compile/mdo002.hs b/testsuite/tests/mdo/should_compile/mdo002.hs index 432825749d..3f9533f247 100644 --- a/testsuite/tests/mdo/should_compile/mdo002.hs +++ b/testsuite/tests/mdo/should_compile/mdo002.hs @@ -21,11 +21,11 @@ instance Monad X where (X a) >>= f = f a instance MonadFix X where - mfix f = fix (f . unX) + mfix f = fix (f . unX) where unX ~(X x) = x z :: X [Int] z = mdo x <- return (1:x) - return (take 4 x) + return (take 4 x) main = print z diff --git a/testsuite/tests/mdo/should_compile/mdo004.hs b/testsuite/tests/mdo/should_compile/mdo004.hs index 544ee6cc66..fe405b882b 100644 --- a/testsuite/tests/mdo/should_compile/mdo004.hs +++ b/testsuite/tests/mdo/should_compile/mdo004.hs @@ -1,17 +1,17 @@ {-# OPTIONS -XRecursiveDo #-} --- test let bindings, polymorphism is ok provided they are not +-- test let bindings, polymorphism is ok provided they are not -- isolated in a recursive segment -- NB. this is not what Hugs does! module Main (main) where -import Control.Monad.Fix +import Control.Monad.Fix t :: IO (Int, Int) t = mdo let l [] = 0 l (x:xs) = 1 + l xs - return (l "1", l [1,2,3]) + return (l "1", l [1,2,3]) main :: IO () main = t >>= print diff --git a/testsuite/tests/mdo/should_compile/mdo005.hs b/testsuite/tests/mdo/should_compile/mdo005.hs index 0b6301b8a5..c712c5a01e 100644 --- a/testsuite/tests/mdo/should_compile/mdo005.hs +++ b/testsuite/tests/mdo/should_compile/mdo005.hs @@ -4,12 +4,12 @@ module Main (main) where -import Control.Monad.Fix +import Control.Monad.Fix import Data.Maybe ( fromJust ) t = mdo x <- fromJust (mdo x <- Just (1:x) - return (take 4 x)) - return x + return (take 4 x)) + return x main :: IO () -main = print t +main = print t diff --git a/testsuite/tests/mdo/should_fail/mdofail005.hs b/testsuite/tests/mdo/should_fail/mdofail005.hs index b4d52918a5..324973fece 100644 --- a/testsuite/tests/mdo/should_fail/mdofail005.hs +++ b/testsuite/tests/mdo/should_fail/mdofail005.hs @@ -9,4 +9,4 @@ import Control.Monad.Fix main :: IO () main = mdo x <- return (1:x) - return () + return () diff --git a/testsuite/tests/mdo/should_run/mdorun001.hs b/testsuite/tests/mdo/should_run/mdorun001.hs index 8527e5b2b1..cc30d12154 100644 --- a/testsuite/tests/mdo/should_run/mdorun001.hs +++ b/testsuite/tests/mdo/should_run/mdorun001.hs @@ -7,27 +7,27 @@ import Data.Array.IO import Control.Monad norm a = mdo (_, sz) <- getBounds a - s <- ioaA 1 s sz 0 - return () - where - ioaA i s sz acc - | i > sz = return acc - | True = do v <- readArray a i - writeArray a i (v / s) - ioaA (i+1) s sz $! (v + acc) + s <- ioaA 1 s sz 0 + return () + where + ioaA i s sz acc + | i > sz = return acc + | True = do v <- readArray a i + writeArray a i (v / s) + ioaA (i+1) s sz $! (v + acc) toList a = do (_, sz) <- getBounds a - mapM (\i -> readArray a i) [1..sz] + mapM (\i -> readArray a i) [1..sz] test :: Int -> IO () test sz = do - (arr :: IOArray Int Float) <- newArray (1, sz) 12 - putStrLn "Before: " - toList arr >>= print - norm arr - putStrLn "After: " - lst <- toList arr - print lst - putStrLn ("Normalized sum: " ++ show (sum lst)) + (arr :: IOArray Int Float) <- newArray (1, sz) 12 + putStrLn "Before: " + toList arr >>= print + norm arr + putStrLn "After: " + lst <- toList arr + print lst + putStrLn ("Normalized sum: " ++ show (sum lst)) main = test 10 |