[project @ 1996-01-08 20:28:12 by partain]
[ghc-hetmet.git] / ghc / misc / examples / io / io010 / Main.hs
diff --git a/ghc/misc/examples/io/io010/Main.hs b/ghc/misc/examples/io/io010/Main.hs
new file mode 100644 (file)
index 0000000..5e5b0c3
--- /dev/null
@@ -0,0 +1,20 @@
+import LibDirectory (getCurrentDirectory, setCurrentDirectory, 
+                     createDirectory, removeDirectory, getDirectoryContents)
+
+main =
+    getCurrentDirectory >>= \ oldpwd ->
+    createDirectory "foo" >>
+    setCurrentDirectory "foo" >> 
+    getDirectoryContents "." >>= \ [n1, n2] ->
+    if dot n1 && dot n2 then
+        setCurrentDirectory oldpwd >>
+        removeDirectory "foo" >>
+        putStr "Okay\n"
+    else
+        fail "Oops"
+
+
+dot :: String -> Bool
+dot "." = True
+dot ".." = True
+dot _ = False
\ No newline at end of file