[project @ 1996-01-08 20:28:12 by partain]
[ghc-hetmet.git] / ghc / misc / examples / io / io005 / Main.hs
diff --git a/ghc/misc/examples/io/io005/Main.hs b/ghc/misc/examples/io/io005/Main.hs
new file mode 100644 (file)
index 0000000..a987b9f
--- /dev/null
@@ -0,0 +1,11 @@
+import LibSystem (system, ExitCode(..), exitWith)
+
+main = 
+    system "cat dog 1>/dev/null 2>&1" >>= \ ec ->
+    case ec of
+        ExitSuccess   -> putStr "What?!?\n" >> fail "dog succeeded"
+        ExitFailure _ ->
+            system "cat Main.hs 2>/dev/null" >>= \ ec ->
+           case ec of
+               ExitSuccess   -> exitWith ExitSuccess
+               ExitFailure _ -> putStr "What?!?\n" >> fail "cat failed"