summaryrefslogtreecommitdiff
path: root/ghc/misc/examples/io/io010/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'ghc/misc/examples/io/io010/Main.hs')
-rw-r--r--ghc/misc/examples/io/io010/Main.hs20
1 files changed, 20 insertions, 0 deletions
diff --git a/ghc/misc/examples/io/io010/Main.hs b/ghc/misc/examples/io/io010/Main.hs
new file mode 100644
index 0000000000..5e5b0c3d16
--- /dev/null
+++ b/ghc/misc/examples/io/io010/Main.hs
@@ -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