summaryrefslogtreecommitdiff
path: root/testsuite/tests/stranal/should_run/strun003.hs
blob: eaedd59e8cc1ccc099dfb47e7d89079bc06b1cdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
-- This module should run fine with an empty argument list
-- But it won't if the strictness analyser thinks that 'len' is use 
-- strictly, which was the case in GHC 6.0

-- See the io_hack_reqd in DmdAnal.lhs

module Main where

import System.Environment
import System.Exit

main    = do
            args <- getArgs
            let len = read (head args) :: Int

            (if null args && useLazily len
	        then putStrLn "ok" >> exitWith ExitSuccess 
		else return () ) 

            print len

useLazily :: Int -> Bool
useLazily len = ([len,3,4] !! 1) == 3