Hi,
As I discovered, ghc doesn't implement the standard library function "doesFileExist"
correctly. The Haskell report states
The operation doesFileExist returns True if the argument file
exists and is not a directory, and False otherwise.
and I tried the following program:
Test for the Function doesFileExist from the Haskell Standard Library
> module Main where
> import Directory
> main = do
> let
> filename = "./Directory.hs" -- should not exist in the current directory
> exists <- doesFileExist filename
> putStr (filename ++ " does " ++ (if exists then "" else " not ") ++ "exist.\n")
Now, ghc does the following ...
584 mann:~/haskell$ ghc-4.04 -o DoesFileExist DoesFileExist.lhs
ghc-4.04: module version unchanged at 2
/usr/ccs/bin/ld: (Warning) Linker features were used that may not be supported in
future
releases. The +vallcompatwarnings option can be used to display more details, and the
ld(1) man page contains additional information. This warning can be suppressed with
the
+vnocompatwarnings option.
585 mann@kiste:~/haskell$ DoesFileExist
Segmentation fault (core dumped)
586 mann:~/haskell$
Regards,
Matthias Mann
JWG-University, Frankfurt, Germany