764290c7549639777d3662376ad8313b64c3aa3a
[ghc-hetmet.git] / ghc / misc / examples / io / io010 / Main.hs
1 import LibDirectory (getCurrentDirectory, setCurrentDirectory, 
2                      createDirectory, removeDirectory, getDirectoryContents)
3
4 main =
5     getCurrentDirectory >>= \ oldpwd ->
6     createDirectory "foo" >>
7     setCurrentDirectory "foo" >> 
8     getDirectoryContents "." >>= \ [n1, n2] ->
9     if dot n1 && dot n2 then
10         setCurrentDirectory oldpwd >>
11         removeDirectory "foo" >>
12         putStr "Okay\n"
13     else
14         fail "Oops"
15
16
17 dot :: String -> Bool
18 dot "." = True
19 dot ".." = True
20 dot _ = False