Re: [Haskell-cafe] error handling (esp. IO/exceptions)

2009-04-14 Thread Miguel Mitrofanov
What about ErrorT monad transformer? Well, if it's not what you really want, you can define your own one without ugly Error class, so it'd be something like execute :: FilePath - [String] - MyCoolErrorT ExecuteError IO ExitCode On 14 Apr 2009, at 23:29, br...@lorf.org wrote: I'm finding it

Re: [Haskell-cafe] error handling (esp. IO/exceptions)

2009-04-14 Thread brian
On Tuesday, 14.04.09 at 23:36, Miguel Mitrofanov wrote: What about ErrorT monad transformer? I don't see how it helps in my situation. ErrorT doesn't catch exceptions, for example. Suppose I did make something like ErrorT that catches exceptions and turn them into Lefts. Where would (=) get my

Re: [Haskell-cafe] error handling (esp. IO/exceptions)

2009-04-14 Thread Lennart Augustsson
There's no way to make all your tests atomically, e.g, between the test that p exists and executing p, some other process could removce p. So the right way to do this (like opening a file), is to try executing it and let the OS tell you if it failed. On Tue, Apr 14, 2009 at 9:29 PM,

Re: [Haskell-cafe] error handling (esp. IO/exceptions)

2009-04-14 Thread Henning Thielemann
On Tue, 14 Apr 2009, Miguel Mitrofanov wrote: What about ErrorT monad transformer? Well, if it's not what you really want, you can define your own one without ugly Error class, so it'd be something like execute :: FilePath - [String] - MyCoolErrorT ExecuteError IO ExitCode My MyCoolErrorT

Re: [Haskell-cafe] error handling (esp. IO/exceptions)

2009-04-14 Thread Henning Thielemann
On Tue, 14 Apr 2009, br...@lorf.org wrote: On Tuesday, 14.04.09 at 23:36, Miguel Mitrofanov wrote: What about ErrorT monad transformer? I don't see how it helps in my situation. ErrorT doesn't catch exceptions, for example. Suppose I did make something like ErrorT that catches exceptions

Re: [Haskell-cafe] error handling (esp. IO/exceptions)

2009-04-14 Thread brian
On Tuesday, 14.04.09 at 22:13, Lennart Augustsson wrote: So the right way to do this (like opening a file), is to try executing it and let the OS tell you if it failed. I know, but the various functions that create processes don't help me know whether the program actually ran or not. For

Re: [Haskell-cafe] error handling (esp. IO/exceptions)

2009-04-14 Thread Donn Cave
Quoth br...@lorf.org, On Tuesday, 14.04.09 at 22:13, Lennart Augustsson wrote: So the right way to do this (like opening a file), is to try executing it and let the OS tell you if it failed. I know, but the various functions that create processes don't help me know whether the program

Re: [Haskell-cafe] error handling (esp. IO/exceptions)

2009-04-14 Thread Donn Cave
Quoth br...@lorf.org, execute :: FilePath - [String] - IO (Either ExecuteError ExitCode) where 'ExecuteError' is a data type representing all the ways 'execute' could fail and that 'execute p args' is supposed to * ensure p exists * get p's permissions * ensure p is readable * ensure p