You have an extra >>(or optional do) on line 13:
_ -> do putStrLn ("Run this way: ./projekt inputFile RE") >>
it should be:
_ -> do putStrLn ("Run this way: ./projekt inputFile RE")
or
_ -> putStrLn ("Run this way: ./projekt inputFile RE") >> exitFailure
Full code:
main = do
l@(x:xs) <- getArgs
case length l of
2 -> do catch (readFile x) $ \_ -> do
putStrLn $ "Error on reading file: " ++ x
getLine
exitWith ExitSuccess
_ -> do putStrLn $ "Run this way: ./projekt inputFile RE"
exitFailure
source
share