Re: [Haskell-cafe] Problems with GHC API and error handling

2013-06-16 Thread Daniel F
OK, thanks to Luite Stegeman I've found the solution and I think I'll post it here in case someone else stumbles upon the same problem. The solution is the following: you have to change 'log_action' parameter in dynFlags. For example, one can do this:

[Haskell-cafe] Problems with GHC API and error handling

2013-06-15 Thread Daniel F
Hello, everyone. I am in need of setting up custom exception handlers when using GHC API to compile modules. Right now I have the following piece of code: * Main.hs: -- import GHC import GHC.Paths

Re: [Haskell-cafe] Troubles understanding Parsec Error Handling

2012-06-11 Thread Antoine Latter
On Wed, May 30, 2012 at 5:47 PM, Roman Cheplyaka r...@ro-che.info wrote: With this patch your code prints:    parse error at (line 1, column 7):    unexpected Hallofb, expecting one of [Hello,Hallo,Foo,HallofFame] Hi folks, Roman's patch has been included in the newly-released parsec

Re: [Haskell-cafe] Troubles understanding Parsec Error Handling

2012-05-31 Thread Matthias Hörmann
Hello Thanks for the quick help with this. I thought about the idea that lookAhead might be the cause of the positioning bug but then discarded that idea because I thought lookAhead should never lead to an error past wherever the input position is now considering it doesn't consume any input. I

Re: [Haskell-cafe] Troubles understanding Parsec Error Handling

2012-05-31 Thread Roman Cheplyaka
* Matthias Hörmann mhoerm...@gmail.com [2012-05-31 10:40:31+0200] I noticed there are still some other problems in the code. In particular it doesn't work as intended in cases like this one: parseTest (do; r1 - anyOf [Hello, Hallo, Foo, HallofFame]; r2 - string fbla; return (r1, r2))

[Haskell-cafe] Troubles understanding Parsec Error Handling

2012-05-30 Thread Matthias Hörmann
I recently started writing my first application at work in Haskell and it deals with a lot of parsing. Among other things I often have to check for a lot of alternatives for fixed strings (parsing natural language text and people have a lot of ways to abbreviate the same thing in labels). So far I

Re: [Haskell-cafe] Troubles understanding Parsec Error Handling

2012-05-30 Thread Kevin Charter
Hi Matthias, On Wed, May 30, 2012 at 1:36 PM, Matthias Hörmann mhoerm...@gmail.comwrote: parseTest (do; r1 - anyOf [Hello, Hallo, Foo, HallofFame]; r2 - string bla; return (r1, r2)) Hallofbla which prints this: parse error at (line 1, column 8):unknown parse error And my question about

Re: [Haskell-cafe] Troubles understanding Parsec Error Handling

2012-05-30 Thread Kevin Charter
On Wed, May 30, 2012 at 3:11 PM, Kevin Charter kchar...@gmail.com wrote: What version of parsec 3 are you using? In version 3.1.1, I get (using Text.Parsec.String instead of Text.Parsec.Text): Ah, answered my own question. I gather you're using 3.1.2, since it's the first and so far only

Re: [Haskell-cafe] Troubles understanding Parsec Error Handling

2012-05-30 Thread Antoine Latter
On Wed, May 30, 2012 at 4:18 PM, Kevin Charter kchar...@gmail.com wrote: On Wed, May 30, 2012 at 3:11 PM, Kevin Charter kchar...@gmail.com wrote: What version of parsec 3 are you using? In version 3.1.1, I get (using Text.Parsec.String instead of Text.Parsec.Text): Ah, answered my own

Re: [Haskell-cafe] Troubles understanding Parsec Error Handling

2012-05-30 Thread Roman Cheplyaka
* Matthias Hörmann mhoerm...@gmail.com [2012-05-30 21:36:13+0200] And my question about this is made up of two parts 1. Why doesn't it print my unexpected message but instead says unknown parse error 2. Why is the location in the text off (I would expect it to fail at column 6 (first

Re: [Haskell-cafe] Troubles understanding Parsec Error Handling

2012-05-30 Thread Kevin Charter
Hi Antoine and Roman, On Wed, May 30, 2012 at 4:14 PM, Antoine Latter aslat...@gmail.com wrote: We changed how 'try' handled errors in some cases in between 3.1.1 and 3.1.2. I'll take a look at this. Antoine Thanks for confirming -- I tried 3.1.2 and got the same result as Matthias. And

[Haskell-cafe] Can we write a parser with both name resolution and error handling by using Happy?

2012-04-29 Thread Tsuyoshi Ito
return anything like `Nothing`, defeating the purpose of the use of a monadic parser for error handling. See https://gist.github.com/2554122 for a code (which does not run). From this, it does not seem that name resolution can be performed inside a parser if we need any error handling better than

[Haskell-cafe] Explicitly Typed Exceptions in Haskell 98 (Was: Idiomatic error handling in Haskell)

2011-03-07 Thread Henning Thielemann
On Wed, 2 Mar 2011, Henning Thielemann wrote: On Wed, 2 Mar 2011, Rouan van Dalen wrote: I would like to know what is the preferred Haskell mechanism for handling exceptions in the IO monad? I am not concerned with mechanisms such as Maybe / Either, but would like to know about exception

[Haskell-cafe] Idiomatic error handling in Haskell

2011-03-02 Thread Rouan van Dalen
There are quite a few exception handling mechanisms provided by Haskell, as can be seen from this post: http://www.randomhacks.net/articles/2007/03/10/haskell-8-ways-to-report-errors I would like to know what is the preferred Haskell mechanism for handling exceptions in the IO monad? I am not

Re: [Haskell-cafe] Idiomatic error handling in Haskell

2011-03-02 Thread Henning Thielemann
On Wed, 2 Mar 2011, Rouan van Dalen wrote: I would like to know what is the preferred Haskell mechanism for handling exceptions in the IO monad? I am not concerned with mechanisms such as Maybe / Either, but would like to know about exception mechanisms inside the IO monad. The 2 I know

[Haskell-cafe] Error handling with safer-file-handling

2010-11-15 Thread Florian Weimer
How am I supposed to write an exception handle for an invocation of System.IO.SaferFileHandles.openFile? Currently, I have got this: case req of Open path - do handle -openFile (asAbsPath path) ReadMode liftIO $ forcePut result Success run handle Follwing

Re: [Haskell-cafe] Error handling with safer-file-handling

2010-11-15 Thread Bas van Dijk
On Sun, Nov 14, 2010 at 12:38 PM, Florian Weimer f...@deneb.enyo.de wrote: How am I supposed to write an exception handle for an invocation of System.IO.SaferFileHandles.openFile? Currently, I have got this:  case req of    Open path - do      handle -openFile (asAbsPath path) ReadMode    

Re: [Haskell-cafe] Bug in HTTP (bad internal error handling)

2010-11-03 Thread Simon Marlow
On 29/10/2010 23:24, Ganesh Sittampalam wrote: On Fri, 22 Oct 2010, Sigbjorn Finne wrote: On Fri, Oct 22, 2010 at 9:35 AM, Sittampalam, Ganesh ganesh.sittampa...@credit-suisse.com wrote: libraries@, what's the right way to proceed? Can I make a Debian-style non-maintainer upload with

Re: [Haskell-cafe] Bug in HTTP (bad internal error handling)

2010-11-03 Thread Ganesh Sittampalam
On Wed, 3 Nov 2010, Simon Marlow wrote: On 29/10/2010 23:24, Ganesh Sittampalam wrote: 4000.0.10 should fix the reported issue with fail and Either, and bumps the base dep to build with GHC 7.0 That's great. Any chance you could also look at this one, which appears to be a pretty serious

Re: [Haskell-cafe] Bug in HTTP (bad internal error handling)

2010-10-29 Thread Ganesh Sittampalam
On Fri, 22 Oct 2010, Sigbjorn Finne wrote: On Fri, Oct 22, 2010 at 9:35 AM, Sittampalam, Ganesh ganesh.sittampa...@credit-suisse.com wrote: libraries@, what's the right way to proceed? Can I make a Debian-style non-maintainer upload with minimal changes to fix urgent issues like these?

Re: [Haskell-cafe] Bug in HTTP (bad internal error handling)

2010-10-24 Thread Ganesh Sittampalam
On Sun, 24 Oct 2010, Bit Connor wrote: On Sat, Oct 23, 2010 at 8:49 PM, Ganesh Sittampalam gan...@earth.li wrote: I'm just looking at fixing this so I can make an upload as discussed with Sigbjorn. I guess the best thing to do is to make all the calls to fail into something more explicit.

Re: [Haskell-cafe] Bug in HTTP (bad internal error handling)

2010-10-23 Thread Ganesh Sittampalam
Hi Bit, On Thu, 21 Oct 2010, Bit Connor wrote: On Sat, Oct 16, 2010 at 10:29 AM, Claus Reinke claus.rei...@talk21.com wrote: After it catches this error, the function returns (line 376): return (fail (show e)) The fail is running in the Either monad (The Result type = Either). This calls

Re: [Haskell-cafe] Bug in HTTP (bad internal error handling)

2010-10-23 Thread Bit Connor
On Sat, Oct 23, 2010 at 8:49 PM, Ganesh Sittampalam gan...@earth.li wrote: Hi Bit, On Thu, 21 Oct 2010, Bit Connor wrote: On Sat, Oct 16, 2010 at 10:29 AM, Claus Reinke claus.rei...@talk21.com wrote: After it catches this error, the function returns (line 376): return (fail (show e))

RE: [Haskell-cafe] Bug in HTTP (bad internal error handling)

2010-10-22 Thread Sittampalam, Ganesh
Bit Connor wrote: On Sat, Oct 16, 2010 at 10:29 AM, Claus Reinke claus.rei...@talk21.com wrote: After it catches this error, the function returns (line 376): return (fail (show e)) The fail is running in the Either monad (The Result type = Either). This calls the default Monad

Re: [Haskell-cafe] Bug in HTTP (bad internal error handling)

2010-10-22 Thread Sigbjorn Finne
On Fri, Oct 22, 2010 at 9:35 AM, Sittampalam, Ganesh ganesh.sittampa...@credit-suisse.com wrote: Bit Connor wrote: On Sat, Oct 16, 2010 at 10:29 AM, Claus Reinke claus.rei...@talk21.com wrote: After it catches this error, the function returns (line 376): return (fail (show e)) The

Re: [Haskell-cafe] Bug in HTTP (bad internal error handling)

2010-10-22 Thread Michael Snoyman
On Fri, Oct 22, 2010 at 11:36 AM, Sigbjorn Finne sigbjorn.fi...@gmail.com wrote: On Fri, Oct 22, 2010 at 9:35 AM, Sittampalam, Ganesh ganesh.sittampa...@credit-suisse.com wrote: Bit Connor wrote: On Sat, Oct 16, 2010 at 10:29 AM, Claus Reinke claus.rei...@talk21.com wrote: After it

Re: [Haskell-cafe] Bug in HTTP (bad internal error handling)

2010-10-21 Thread Bit Connor
On Sat, Oct 16, 2010 at 10:29 AM, Claus Reinke claus.rei...@talk21.com wrote: After it catches this error, the function returns (line 376): return (fail (show e)) The fail is running in the Either monad (The Result type = Either). This calls the default Monad implementation of fail, which is

[Haskell-cafe] Bug in HTTP (bad internal error handling)

2010-10-16 Thread Bit Connor
Hello, I have reported this problem to the maintainer of the HTTP package about 2 weeks ago, but have not yet received a response, so I am reporting it here. I am using a recent git check out of HTTP 4000.0.10 The bufferReadLine function from Network.TCP has a bug in how it handles an

Re: [Haskell-cafe] Bug in HTTP (bad internal error handling)

2010-10-16 Thread Claus Reinke
After it catches this error, the function returns (line 376): return (fail (show e)) The fail is running in the Either monad (The Result type = Either). This calls the default Monad implementation of fail, which is just a call to plain old error. This basically causes the entire program to

Re: [Haskell-cafe] Speed of Error handling with Continuations vs. Eithers

2010-05-16 Thread Andrea Vezzosi
On Thu, May 13, 2010 at 8:13 PM, wren ng thornton w...@freegeek.org wrote: Andrea Vezzosi wrote: On Thu, May 13, 2010 at 10:51 AM, wren ng thornton w...@freegeek.org wrote: Andrea Vezzosi wrote: wren ng thornton  wrote: With this change [1] I can't notice any difference for your

Re: [Haskell-cafe] Speed of Error handling with Continuations vs. Eithers

2010-05-16 Thread roconnor
On Fri, 14 May 2010, Derek Elkins wrote: You did it wrong. All you did was Church encode the Either type. Your bind is still doing a case-analysis. All you have to do is use ContT r (Either e). The bind implementation for ContT is completely independent of the underlying monad. It doesn't

Re: [Haskell-cafe] Speed of Error handling with Continuations vs. Eithers

2010-05-15 Thread Max Cantor
Where is my bind statement doing a case analysis? Isn't it just propagating, in a sense, the case analysis that came from values coming into the monad via return or via throwError? Also, why wouldn't callCC work here? I'm not that familiar with the ContT monad so any more details would be

Re: [Haskell-cafe] Speed of Error handling with Continuations vs. Eithers

2010-05-15 Thread Derek Elkins
On Sat, May 15, 2010 at 2:28 PM, Max Cantor mxcan...@gmail.com wrote: Where is my bind statement doing a case analysis? Isn't it just propagating, in a sense, the case analysis that came from values coming into the monad via return or via throwError? What you did was reimplement the Either

Re: [Haskell-cafe] Speed of Error handling with Continuations vs. Eithers

2010-05-15 Thread Antoine Latter
On Fri, May 14, 2010 at 4:25 PM, Derek Elkins derek.a.elk...@gmail.com wrote: You did it wrong.  All you did was Church encode the Either type. Your bind is still doing a case-analysis.  All you have to do is use ContT r (Either e).  The bind implementation for ContT is completely independent

Re: [Haskell-cafe] Speed of Error handling with Continuations vs. Eithers

2010-05-15 Thread Derek Elkins
On Sat, May 15, 2010 at 9:20 PM, Antoine Latter aslat...@gmail.com wrote: On Fri, May 14, 2010 at 4:25 PM, Derek Elkins derek.a.elk...@gmail.com wrote: You did it wrong.  All you did was Church encode the Either type. Your bind is still doing a case-analysis.  All you have to do is use ContT

Re: [Haskell-cafe] Speed of Error handling with Continuations vs. Eithers

2010-05-14 Thread Henning Thielemann
On Mon, 10 May 2010, Max Cantor wrote: Based on some discussions in #haskell, it seemed to be a consensus that using a modified continuation monad for Error handling instead of Eithers would be a significant optimization since it would eliminate a lot of conditional branching (everytime

Re: [Haskell-cafe] Speed of Error handling with Continuations vs. Eithers

2010-05-14 Thread Derek Elkins
at 4:38 AM, Max Cantor mxcan...@gmail.com wrote: Based on some discussions in #haskell, it seemed to be a consensus that using a modified continuation monad for Error handling instead of Eithers would be a significant optimization since it would eliminate a lot of conditional branching

Re: [Haskell-cafe] Speed of Error handling with Continuations vs. Eithers

2010-05-14 Thread Antoine Latter
On Fri, May 14, 2010 at 4:25 PM, Derek Elkins derek.a.elk...@gmail.com wrote: You did it wrong.  All you did was Church encode the Either type. Your bind is still doing a case-analysis.  All you have to do is use ContT r (Either e).  The bind implementation for ContT is completely independent

Re: [Haskell-cafe] Speed of Error handling with Continuations vs. Eithers

2010-05-14 Thread Derek Elkins
On Fri, May 14, 2010 at 4:53 PM, Antoine Latter aslat...@gmail.com wrote: On Fri, May 14, 2010 at 4:25 PM, Derek Elkins derek.a.elk...@gmail.com wrote: You did it wrong.  All you did was Church encode the Either type. Your bind is still doing a case-analysis.  All you have to do is use ContT

Re: [Haskell-cafe] Speed of Error handling with Continuations vs. Eithers

2010-05-13 Thread wren ng thornton
Andrea Vezzosi wrote: wren ng thornton wrote: With this change [1] I can't notice any difference for your benchmark[2]. Then again, all the runTest calls take 0 msec and I've had no luck making the computation take much time; perhaps your computer can detect a difference. On my machine, with

Re: [Haskell-cafe] Speed of Error handling with Continuations vs. Eithers

2010-05-13 Thread wren ng thornton
Antoine Latter wrote: While I also offer a transformer version of MaybeCPS, the transformer *does* suffer from significant slowdown. Also, for MaybeCPS it's better to leave the handlers inline in client code rather than to abstract them out; that helps to keep things concrete. So perhaps you

Re: [Haskell-cafe] Speed of Error handling with Continuations vs. Eithers

2010-05-13 Thread Andrea Vezzosi
On Thu, May 13, 2010 at 10:51 AM, wren ng thornton w...@freegeek.org wrote: Andrea Vezzosi wrote: wren ng thornton  wrote: With this change [1] I can't notice any difference for your benchmark[2]. Then again, all the runTest calls take 0 msec and I've had no luck making the computation take

Re: [Haskell-cafe] Speed of Error handling with Continuations vs. Eithers

2010-05-13 Thread wren ng thornton
Andrea Vezzosi wrote: On Thu, May 13, 2010 at 10:51 AM, wren ng thornton w...@freegeek.org wrote: Andrea Vezzosi wrote: wren ng thornton wrote: With this change [1] I can't notice any difference for your benchmark[2]. Then again, all the runTest calls take 0 msec and I've had no luck making

Re: [Haskell-cafe] Speed of Error handling with Continuations vs. Eithers

2010-05-12 Thread Andrea Vezzosi
On Wed, May 12, 2010 at 7:50 AM, wren ng thornton w...@freegeek.org wrote: wren ng thornton wrote: Here's one big difference: newtype ErrCPS e m a = ErrCPS { runErrCPS ::    forall r . (e - m r) --  error handler    - (a - m r) --  success handler    - m r } The analogous version I use

Re: [Haskell-cafe] Speed of Error handling with Continuations vs. Eithers

2010-05-12 Thread Antoine Latter
On Tue, May 11, 2010 at 8:28 PM, wren ng thornton w...@freegeek.org wrote: Max Cantor wrote: Based on some discussions in #haskell, it seemed to be a consensus that using a modified continuation monad for Error handling instead of Eithers would be a significant optimization since it would

Re: [Haskell-cafe] Speed of Error handling with Continuations vs. Eithers

2010-05-11 Thread wren ng thornton
Max Cantor wrote: Based on some discussions in #haskell, it seemed to be a consensus that using a modified continuation monad for Error handling instead of Eithers would be a significant optimization since it would eliminate a lot of conditional branching (everytime = is called in the Either

Re: [Haskell-cafe] Speed of Error handling with Continuations vs. Eithers

2010-05-11 Thread wren ng thornton
wren ng thornton wrote: Here's one big difference: newtype ErrCPS e m a = ErrCPS { runErrCPS :: forall r . (e - m r) -- error handler - (a - m r) -- success handler - m r } The analogous version I use is: newtype MaybeCPS a = MaybeCPS (forall r. (a - Maybe r) -

[Haskell-cafe] Speed of Error handling with Continuations vs. Eithers

2010-05-10 Thread Max Cantor
Based on some discussions in #haskell, it seemed to be a consensus that using a modified continuation monad for Error handling instead of Eithers would be a significant optimization since it would eliminate a lot of conditional branching (everytime = is called in the Either monad

Re: [Haskell-cafe] Speed of Error handling with Continuations vs. Eithers

2010-05-10 Thread Jan-Willem Maessen
On Mon, May 10, 2010 at 5:38 AM, Max Cantor mxcan...@gmail.com wrote: Based on some discussions in #haskell, it seemed to be a consensus that using a modified continuation monad for Error handling instead of Eithers would be a significant optimization since it would eliminate a lot

Re: [Haskell-cafe] Speed of Error handling with Continuations vs. Eithers

2010-05-10 Thread Max Cantor
in #haskell, it seemed to be a consensus that using a modified continuation monad for Error handling instead of Eithers would be a significant optimization since it would eliminate a lot of conditional branching (everytime = is called in the Either monad, there is a conditional. My suspicion

[Haskell-cafe] Re: HXT error handling

2010-04-06 Thread Uwe Schmidt
Hi Mads, I am trying to use HXT to evaluate XPath expressions. The XPath expressions are not specified by myself, but by users of my program. However, the idea behind HXT's error handling confuses me. Maybe somebody can enlighten me. This program fragment: evalXPath :: String - String

[Haskell-cafe] Re: HXT error handling

2010-04-06 Thread Mads Lindstrøm
Hi Uwe This is a right point. Here the current XPath calling interface is too simple. A separation into XPath parsing and evaluation would be more flexible. The parsing (and error handling of XPath syntax errors) could be done once. I will extend the interface to support this. That would

[Haskell-cafe] Re: HXT error handling

2010-04-06 Thread Uwe Schmidt
Hi Mads, This is a right point. Here the current XPath calling interface is too simple. A separation into XPath parsing and evaluation would be more flexible. The parsing (and error handling of XPath syntax errors) could be done once. I will extend the interface to support

[Haskell-cafe] HXT error handling

2010-04-04 Thread Mads Lindstrøm
Hi I am trying to use HXT to evaluate XPath expressions. The XPath expressions are not specified by myself, but by users of my program. However, the idea behind HXT's error handling confuses me. Maybe somebody can enlighten me. This program fragment: evalXPath :: String - String - [XmlTree

Re: [Haskell-cafe] Are there standard idioms for lazy, pure error handling?

2009-12-13 Thread Bertram Felgenhauer
Duncan Coutts wrote: Another approach that some people have advocated as a general purpose solution is to use: data Exceptional e a = Exceptional { exception :: Maybe e result:: a } However it's pretty clear from the structure of this type that it cannot cope with lazy error

[Haskell-cafe] Re: Are there standard idioms for lazy, pure error handling?

2009-12-09 Thread Heinrich Apfelmus
Nicolas Pouillard wrote: Henning Thielemann wrote: @Apfelmus: For practical purposes I think Train should have swapped type parameters in order to make Functor act on the type of the list elements. data Train b a = Wagon a (Train b a) | Loco b The functor on the

[Haskell-cafe] Re: Are there standard idioms for lazy, pure error handling?

2009-12-09 Thread Duncan Coutts
/0.1.4/doc/html/Control-Monad-Exception-Asynchronous.html Duncan already mentioned it: data Exceptional e a = Exceptional { exception :: Maybe e result:: a } However it's pretty clear from the structure of this type that it cannot cope with lazy error handling in sequences

Re: [Haskell-cafe] Re: New Hackage category: Error Handling

2009-12-07 Thread Henning Thielemann
Michael Snoyman schrieb: On Mon, Dec 7, 2009 at 5:30 AM, Ben Franksen ben.frank...@online.de mailto:ben.frank...@online.de wrote: Michael Snoyman wrote: On the other hand, what's so bad about treating errors as exceptions? If instead of the program crashing on an

Re: [Haskell-cafe] Re: New Hackage category: Error Handling

2009-12-07 Thread Michael Snoyman
On Mon, Dec 7, 2009 at 2:13 PM, Henning Thielemann lemm...@henning-thielemann.de wrote: Michael Snoyman schrieb: On Mon, Dec 7, 2009 at 5:30 AM, Ben Franksen ben.frank...@online.de mailto:ben.frank...@online.de wrote: Michael Snoyman wrote: On the other hand, what's so

[Haskell-cafe] Re: New Hackage category: Error Handling

2009-12-07 Thread Henning Thielemann
On Mon, 7 Dec 2009, Michael Snoyman wrote: The only opinion I've stated so far is that it's ridiculous to constantly demand that people follow your definition of error vs exception, since the line is incredibly blurry and it buys you very little. If you have an example that is not contained

[Haskell-cafe] Re: New Hackage category: Error Handling

2009-12-07 Thread Michael Snoyman
On Mon, Dec 7, 2009 at 9:07 PM, Henning Thielemann lemm...@henning-thielemann.de wrote: On Mon, 7 Dec 2009, Michael Snoyman wrote: The only opinion I've stated so far is that it's ridiculous to constantly demand that people follow your definition of error vs exception, since the line is

[Haskell-cafe] Re: New Hackage category: Error Handling

2009-12-07 Thread Henning Thielemann
I turn it around: give me an example where it's better for the runtime to exit than for some type of exception to be thrown, and *I'll* think about it ;). If you would have read my article, you had one ... ___ Haskell-Cafe mailing list

[Haskell-cafe] Re: Are there standard idioms for lazy, pure error handling?

2009-12-07 Thread Henning Thielemann
already mentioned it: data Exceptional e a = Exceptional { exception :: Maybe e result:: a } However it's pretty clear from the structure of this type that it cannot cope with lazy error handling in sequences. If you try it you'll find you cannot do it without space leaks. Actually

[Haskell-cafe] Re: Are there standard idioms for lazy, pure error handling?

2009-12-07 Thread Henning Thielemann
@Apfelmus: For practical purposes I think Train should have swapped type parameters in order to make Functor act on the type of the list elements. data Train b a = Wagon a (Train b a) | Loco b ___ Haskell-Cafe mailing list

[Haskell-cafe] Re: New Hackage category: Error Handling

2009-12-07 Thread Henning Thielemann
On Mon, 7 Dec 2009, Michael Snoyman wrote: I actually *did* read your article, and don't know what you are referring to. If this is true, sorry, I didn't had the impression. I also think that in an earlier mail I answered, that errors can leave you with corrupt data, say invalid file

Re: [Haskell-cafe] Re: Are there standard idioms for lazy, pure error handling?

2009-12-07 Thread Nicolas Pouillard
Excerpts from Henning Thielemann's message of Mon Dec 07 20:36:27 +0100 2009: @Apfelmus: For practical purposes I think Train should have swapped type parameters in order to make Functor act on the type of the list elements. data Train b a = Wagon a (Train b a) | Loco

[Haskell-cafe] Re: New Hackage category: Error Handling

2009-12-07 Thread Michael Snoyman
On Mon, Dec 7, 2009 at 9:53 PM, Henning Thielemann lemm...@henning-thielemann.de wrote: On Mon, 7 Dec 2009, Michael Snoyman wrote: I actually *did* read your article, and don't know what you are referring to. If this is true, sorry, I didn't had the impression. I also think that in an

Re: [Haskell-cafe] Re: New Hackage category: Error Handling

2009-12-07 Thread Richard O'Keefe
When I was working at Quintus, I came up with a classification which I can simplify something like this: operating system fault Something bad happened (like a remote node going down) that was entirely out of your control. There is nothing you can do to your program to

[Haskell-cafe] Re: New Hackage category: Error Handling

2009-12-07 Thread Ben Franksen
Michael Snoyman wrote: On Mon, Dec 7, 2009 at 9:53 PM, Henning Thielemann lemm...@henning-thielemann.de wrote: On Mon, 7 Dec 2009, Michael Snoyman wrote: I also think that in an earlier mail I answered, that errors can leave you with corrupt data, say invalid file handles, memory pointers,

Re: [Haskell-cafe] Re: New Hackage category: Error Handling

2009-12-07 Thread Henning Thielemann
On Tue, 8 Dec 2009, Richard O'Keefe wrote: When I was working at Quintus, I came up with a classification which I can simplify something like this: It's certainly possible to classify errors and exceptions in other (also more fine grained) ways ... operating system fault

Re: [Haskell-cafe] Re: New Hackage category: Error Handling

2009-12-07 Thread Richard O'Keefe
On Dec 8, 2009, at 12:28 PM, Henning Thielemann wrote: representation faults your program tried to do something meaningful but the system was unable to represent the result (integer overflow, upper case of ÿ in a Latin 1 system, floating point overflow on a

Re: [Haskell-cafe] Re: New Hackage category: Error Handling

2009-12-07 Thread Henning Thielemann
On Tue, 8 Dec 2009, Ben Franksen wrote: Michael, Henning There are two meanings to the word 'exception' in this context; both of you tend to conflate these different meanings. One meaning is about a *mechanism* for non-local control flow; the other is about certain classes of un-desired

Re: [Haskell-cafe] Re: New Hackage category: Error Handling

2009-12-07 Thread Henning Thielemann
On Tue, 8 Dec 2009, Richard O'Keefe wrote: X/0, sqrt(-1), head [] are errors It depends on WHERE THE DATA CAME FROM. If your program actually computes X/0 or sqrt(-1) or head [] your program is buggy, independent from where the zero, the minus one or the empty list comes. Sure, the

Re: [Haskell-cafe] Re: New Hackage category: Error Handling

2009-12-07 Thread Henning Thielemann
On Tue, 8 Dec 2009, Richard O'Keefe wrote: On Dec 8, 2009, at 12:28 PM, Henning Thielemann wrote: It is the responsibility of the programmer to choose number types that are appropriate for the application. If I address pixels on a todays screen I will have to choose at least Word16. On

Re: [Haskell-cafe] Re: New Hackage category: Error Handling

2009-12-07 Thread Richard O'Keefe
On Dec 8, 2009, at 1:27 PM, Henning Thielemann wrote: On Tue, 8 Dec 2009, Richard O'Keefe wrote: On Dec 8, 2009, at 12:28 PM, Henning Thielemann wrote: It is the responsibility of the programmer to choose number types that are appropriate for the application. If I address pixels on a

Re: [Haskell-cafe] Re: New Hackage category: Error Handling

2009-12-07 Thread Donn Cave
I'm wondering, what are we talking about here? - the meaning of error and exception? - personal responsibility when writing programs? - language features - library functions, runtime implementation etc.? The first two, I think could serve as the basis for an entertaining discussion. Where

Re: [Haskell-cafe] Re: Are there standard idioms for lazy, pure error handling?

2009-12-07 Thread wren ng thornton
Nicolas Pouillard wrote: Excerpts from Henning Thielemann's message of Mon Dec 07 20:36:27 +0100 2009: @Apfelmus: For practical purposes I think Train should have swapped type parameters in order to make Functor act on the type of the list elements. data Train b a = Wagon a (Train b a)

Re: [Haskell-cafe] Re: New Hackage category: Error Handling

2009-12-07 Thread Michael Snoyman
On Tue, Dec 8, 2009 at 1:25 AM, Ben Franksen ben.frank...@online.de wrote: Michael Snoyman wrote: On Mon, Dec 7, 2009 at 9:53 PM, Henning Thielemann lemm...@henning-thielemann.de wrote: On Mon, 7 Dec 2009, Michael Snoyman wrote: I also think that in an earlier mail I answered, that

Re: [Haskell-cafe] Re: New Hackage category: Error Handling

2009-12-07 Thread Michael Snoyman
On Tue, Dec 8, 2009 at 7:40 AM, Michael Snoyman mich...@snoyman.com wrote: On Tue, Dec 8, 2009 at 1:25 AM, Ben Franksen ben.frank...@online.dewrote: Michael Snoyman wrote: On Mon, Dec 7, 2009 at 9:53 PM, Henning Thielemann lemm...@henning-thielemann.de wrote: On Mon, 7 Dec 2009,

[Haskell-cafe] Re: New Hackage category: Error Handling

2009-12-06 Thread Ben Franksen
Michael Snoyman wrote: On Sun, Dec 6, 2009 at 12:55 AM, Henning Thielemann lemm...@henning-thielemann.de wrote: On Sun, 6 Dec 2009, Michael Snoyman wrote: I think there are plenty of examples like web servers. A text editor with plugins? I don't want to lose three hours worth of work

Re: [Haskell-cafe] Re: New Hackage category: Error Handling

2009-12-06 Thread Michael Snoyman
when suddenly you have garbage data because someone thought huh, this should be negative, will just use the abs function. However, these people will find ways of doing these evils even without exceptions. Bonus: My favorite error-handling line of code at the company was a bit of VBA that went

Re: [Haskell-cafe] New Hackage category: Error Handling

2009-12-06 Thread Alexander Dunlap
On Sat, Dec 5, 2009 at 3:00 PM, Michael Snoyman mich...@snoyman.com wrote: On Sun, Dec 6, 2009 at 12:55 AM, Henning Thielemann lemm...@henning-thielemann.de wrote: On Sun, 6 Dec 2009, Michael Snoyman wrote: I think there are plenty of examples like web servers. A text editor with plugins?

Re: [Haskell-cafe] New Hackage category: Error Handling

2009-12-06 Thread Alexander Dunlap
On Sun, Dec 6, 2009 at 10:40 PM, Alexander Dunlap alexander.dun...@gmail.com wrote: On Sat, Dec 5, 2009 at 3:00 PM, Michael Snoyman mich...@snoyman.com wrote: On Sun, Dec 6, 2009 at 12:55 AM, Henning Thielemann lemm...@henning-thielemann.de wrote: On Sun, 6 Dec 2009, Michael Snoyman wrote:

Re: [Haskell-cafe] New Hackage category: Error Handling

2009-12-06 Thread Michael Snoyman
On Mon, Dec 7, 2009 at 8:40 AM, Alexander Dunlap alexander.dun...@gmail.com wrote: On Sat, Dec 5, 2009 at 3:00 PM, Michael Snoyman mich...@snoyman.com wrote: On Sun, Dec 6, 2009 at 12:55 AM, Henning Thielemann lemm...@henning-thielemann.de wrote: On Sun, 6 Dec 2009, Michael Snoyman

Re: [Haskell-cafe] New Hackage category: Error Handling

2009-12-05 Thread Michael Snoyman
-message, I also went ahead and created a new category: Error Handling. Error handling is the same as debugging for you? I hope it is not intended for generating further confusion about exception handling and debugging (= help programmers to analyse errors

Re: [Haskell-cafe] New Hackage category: Error Handling

2009-12-05 Thread Ross Paterson
On Sat, Dec 05, 2009 at 05:52:11PM +0200, Michael Snoyman wrote: For the record, I find this pedanticism misplaced, ... I think you'll find that's pedantry. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] New Hackage category: Error Handling

2009-12-05 Thread Michael Snoyman
On Sat, Dec 5, 2009 at 7:41 PM, Ross Paterson r...@soi.city.ac.uk wrote: On Sat, Dec 05, 2009 at 05:52:11PM +0200, Michael Snoyman wrote: For the record, I find this pedanticism misplaced, ... I think you'll find that's pedantry. Hoped someone would comment exactly that ;).

Re: [Haskell-cafe] New Hackage category: Error Handling

2009-12-05 Thread Henning Thielemann
On Sat, 5 Dec 2009, Michael Snoyman wrote: On Sat, Dec 5, 2009 at 7:41 PM, Ross Paterson r...@soi.city.ac.uk wrote: On Sat, Dec 05, 2009 at 05:52:11PM +0200, Michael Snoyman wrote: For the record, I find this pedanticism misplaced, ... I think you'll find that's pedantry.

Re: [Haskell-cafe] New Hackage category: Error Handling

2009-12-05 Thread Michael Snoyman
On Sun, Dec 6, 2009 at 12:17 AM, Henning Thielemann lemm...@henning-thielemann.de wrote: On Sat, 5 Dec 2009, Michael Snoyman wrote: On Sat, Dec 5, 2009 at 7:41 PM, Ross Paterson r...@soi.city.ac.uk wrote: On Sat, Dec 05, 2009 at 05:52:11PM +0200, Michael Snoyman wrote: For the

Re: [Haskell-cafe] New Hackage category: Error Handling

2009-12-05 Thread Henning Thielemann
On Sun, 6 Dec 2009, Michael Snoyman wrote: I think there are plenty of examples like web servers. A text editor with plugins? I don't want to lose three hours worth of work just because some plugin wasn't written correctly. For many classes of programs, the distinction between error and

Re: [Haskell-cafe] New Hackage category: Error Handling

2009-12-05 Thread Michael Snoyman
On Sun, Dec 6, 2009 at 12:55 AM, Henning Thielemann lemm...@henning-thielemann.de wrote: On Sun, 6 Dec 2009, Michael Snoyman wrote: I think there are plenty of examples like web servers. A text editor with plugins? I don't want to lose three hours worth of work just because some plugin

Re: [Haskell-cafe] New Hackage category: Error Handling

2009-12-05 Thread Gregory Crosswhite
On Dec 5, 2009, at 3:00 PM, Michael Snoyman wrote: I think we can all appreciate why it would be a bad thing is we treat exceptions as errors. For example, I don't want my program to crash on a file not found. On the other hand, what's so bad about treating errors as exceptions? If

Re: [Haskell-cafe] New Hackage category: Error Handling

2009-12-05 Thread Henning Thielemann
On Sat, 5 Dec 2009, Henning Thielemann wrote: On Sun, 6 Dec 2009, Michael Snoyman wrote: I think there are plenty of examples like web servers. A text editor with plugins? I don't want to lose three hours worth of work just because some plugin wasn't written correctly. For many classes of

[Haskell-cafe] Re: Are there standard idioms for lazy, pure error handling?

2009-12-04 Thread Heinrich Apfelmus
Ketil Malde wrote: Although I don't care for the cutesy naming suggested in the 'Train' datatype [...] data TerminatedList a e = Then a (TerminatedList a e) | Finally e (So you could do e.g: 4 `Then` 5 `Then` 1 `Finally` success!. Of course, you might prefer

Re: [Haskell-cafe] Are there standard idioms for lazy, pure error handling?

2009-12-04 Thread wren ng thornton
wren ng thornton wrote: One of the nice things about not having a Nil is that it lets you easily be polymorphic over things ending in () ---a normal list---, (Maybe a) ---a fallible list---, (Either a b) ---your progress type---, etc. Whereas the version that has both Nil and End forces us

Re: [Haskell-cafe] New Hackage category: Error Handling

2009-12-04 Thread Henning Thielemann
Gregory Crosswhite schrieb: When I uploaded my new package, error-message, I also went ahead and created a new category: Error Handling. Error handling is the same as debugging for you? I hope it is not intended for generating further confusion about exception handling and debugging (= help

Re: [Haskell-cafe] Are there standard idioms for lazy, pure error handling?

2009-12-04 Thread Duncan Coutts
the fold is defined by the data type, except when we are pretending that one data type is another. This type is intended as a list that is annotated with errors. So I want to be able to switch between list versions and this version just by adding an extra error-handling parameter to the ordinary list

Re: [Haskell-cafe] Are there standard idioms for lazy, pure error handling?

2009-12-04 Thread Jason McCarty
wren ng thornton wrote: concat1 :: T a b - (b - T a b) - T a b This could just as easily be concat :: T a b - (b - T a c) - T a c right? It's a little weird to call this concatenation, but I bet it could come in handy. -- Jason McCarty jmcca...@sent.com

Re: [Haskell-cafe] Are there standard idioms for lazy, pure error handling?

2009-12-04 Thread David Menendez
On Fri, Dec 4, 2009 at 1:14 PM, Jason McCarty jmcca...@sent.com wrote: wren ng thornton wrote:     concat1 :: T a b - (b - T a b) - T a b This could just as easily be  concat :: T a b - (b - T a c) - T a c right? It's a little weird to call this concatenation, but I bet it could come in

Re: [Haskell-cafe] Are there standard idioms for lazy, pure error handling?

2009-12-04 Thread wren ng thornton
Jason McCarty wrote: wren ng thornton wrote: concat1 :: T a b - (b - T a b) - T a b This could just as easily be concat :: T a b - (b - T a c) - T a c right? It's a little weird to call this concatenation, but I bet it could come in handy. Er right, that's what I meant. (Again the

  1   2   >