URGENT: File exists
Tim Barbour
trb@eastpac.com.au
Tue, 6 Nov 2001 12:07:45 +1100 (EST)
bracaman@box.sk writes:
> I am trying to emulate bash in haskell, and i got a function called shell
> that waits fot the command and then executes it. The problem is that if the
> file does not exist, the program returns to Main (it gets out of the
> shell). The only thing i want to do is to return to the shell after an
> IOError.
>
> How can i perform such a thing?
See the documentation at:
http://haskell.org/ghc/docs/latest/set/sec-exception.html
particularly the example:
catch (openFile f ReadMode)
(\e -> hPutStr stderr ("Couldn't open "++f++": " ++ show e))
If GHCi could load the Posix module, that would make a very interesting shell,
but GHCi does not seem to have such ability yet.
Tim
--
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety." -- Benjamin Franklin