Re: Sets of IOErrors?

1999-09-30 Thread Fergus Henderson
On 29-Sep-1999, Marcin 'Qrczak' Kowalczyk <[EMAIL PROTECTED]> wrote: > I only don't like the details about IOError. It's not extensible > and Dynamic is still not nice. I have no idea how to make it > better. Probably some general way of making extensible datatypes. Could you explain what you don

Re: Sets of IOErrors?

1999-09-30 Thread Fergus Henderson
On 29-Sep-1999, George Russell <[EMAIL PROTECTED]> wrote: > Fergus Henderson wrote: > [many interesting things which are snipped] > > There are many common examples where exceptions arise for reasons other > > than I/O, for example integer overflow, division by zero, taking the > > square root of

Re: Sets of IOErrors?

1999-09-29 Thread Marcin 'Qrczak' Kowalczyk
Thu, 30 Sep 1999 02:08:23 +1000, Fergus Henderson <[EMAIL PROTECTED]> pisze: > > I only don't like the details about IOError. It's not extensible > > and Dynamic is still not nice. I have no idea how to make it > > better. Probably some general way of making extensible datatypes. > > Could you e

Re: Sets of IOErrors?

1999-09-29 Thread George Russell
Fergus Henderson wrote: [snip] > So why limit expressiveness by providing only the former? Why indeed? You are right. I hadn't realised that a -> IO (Maybe a) would still suffer from non-determinism. (Because if you have x = error "foo" + _|_ it may cause a return of Nothing or else no

Re: Sets of IOErrors?

1999-09-29 Thread Johan Nordlander
Alastair Reid wrote: > [discussion of Dynamic library, etc deleted] > > [...] > > If Haskell supported extensible datatypes, it would be easy to define a > hierarchy of exception values. For example, the attached pseudocode > creates a hierarchy like this: > > IOError > Win32Error >

Re: Sets of IOErrors?

1999-09-29 Thread George Russell
Fergus Henderson wrote: [snip] > SML's exception mechanism essentially forces sequential execution, > and (I think) causes problems for equational reasoning. > Haskell's exception mechanism preserves referential transparency > and gives the compiler more freedom to reorder and/or parallelize code.

Re: Sets of IOErrors?

1999-09-29 Thread R.S. Nikhil
A Void" (the French title would translate as "The Disappearance", but that contains e's). It's a fantastic book! I highly recommend it. Nikhil > -Original Message- > From: Jan Skibinski [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, September 29, 1999 10:06

Re: Sets of IOErrors?

1999-09-29 Thread Marcin 'Qrczak' Kowalczyk
Wed, 29 Sep 1999 11:43:06 +0200, George Russell <[EMAIL PROTECTED]> pisze: > When that happens in my code it counts as a bug! Therefore error > is appropriate. If you are in some larger Haskell universe calling > component Haskell code it is unfortunate if a single error calls the > entire univ

Re: Sets of IOErrors?

1999-09-29 Thread George Russell
Fergus Henderson wrote: [many interesting things which are snipped] > There are many common examples where exceptions arise for reasons other > than I/O, for example integer overflow, division by zero, taking the > square root of a negative number, head of an empty list, and so forth. When that ha

Re: Sets of IOErrors?

1999-09-29 Thread Jan Skibinski
On 29 Sep 1999, Marcin 'Qrczak' Kowalczyk wrote: > Wed, 29 Sep 1999 11:43:06 +0200, George Russell <[EMAIL PROTECTED]> pisze: > > > When that happens in my code it counts as a bug! Therefore error > > is appropriate. If you are in some larger Haskell universe calling > > component Haskell co

Re: Sets of IOErrors?

1999-09-29 Thread Fergus Henderson
On 28-Sep-1999, Alastair Reid <[EMAIL PROTECTED]> wrote: > > > > > (b) allow throwing and catching of dynamically typed values, > > > > e.g. using an interface like the Hugs/ghc Dynamic library > > [discussion of Dynamic library, etc deleted] > > [The following is a bit of a straw-man: it d

Re: Sets of IOErrors?

1999-09-29 Thread Fergus Henderson
On 28-Sep-1999, Alastair Reid <[EMAIL PROTECTED]> wrote: > > Fergus Henderson <[EMAIL PROTECTED]> replied: > > What existing functions for testing IOErrors? > > Apart from the Eq and Show classes, Haskell 98 doesn't define any, AFAIK. > > The IO library defines these functions. > (http://haskell

Re: Sets of IOErrors?

1999-09-29 Thread Fergus Henderson
On 28-Sep-1999, George Russell <[EMAIL PROTECTED]> wrote: > I must be missing something. Isn't it blindlingly obvious that > here SML's exception mechanism is streets ahead of Haskell's? Please, > what am I missing? Is there some lurking type-unsafeness? SML's exception mechanism essentially f

Re: Sets of IOErrors?

1999-09-29 Thread Fergus Henderson
On 08-Sep-1999, Alastair Reid <[EMAIL PROTECTED]> wrote: > > I recently had occasion to write this function: > > -- do a, if that fails do b, if that fails, raise b's exception > (?) :: IO a -> IO a -> IO a > a ? b = a `catch` \_ -> b > > Simple enough, but if b fails, I don't really wan

Re: Sets of IOErrors?

1999-09-28 Thread George Russell
Fergus Henderson wrote: [snip] > What existing functions for testing IOErrors? > Apart from the Eq and Show classes, Haskell 98 doesn't define any, AFAIK. > If you're suggesting that Eq or Show be undefined for IOErrors that > represent sets of exceptions, then I would have to disagree... I must b

Re: Sets of IOErrors?

1999-09-28 Thread Alastair Reid
> > > (b) allow throwing and catching of dynamically typed values, > > > e.g. using an interface like the Hugs/ghc Dynamic library [discussion of Dynamic library, etc deleted] [The following is a bit of a straw-man: it doesn't quite work but may have good parts which can be used in other de

Re: Sets of IOErrors?

1999-09-28 Thread Alastair Reid
> On 08-Sep-1999, Alastair Reid <[EMAIL PROTECTED]> wrote: > > What > > I'd like (in some future version of Haskell) is an IOError constructor > > which lets me merge two IOErrors together and appropriate operations > > to test for it and, perhaps, take it apart: Fergus Henderson <[EMAIL PROTECT

Sets of IOErrors?

1999-09-08 Thread Alastair Reid
I recently had occasion to write this function: -- do a, if that fails do b, if that fails, raise b's exception (?) :: IO a -> IO a -> IO a a ? b = a `catch` \_ -> b Simple enough, but if b fails, I don't really want to raise b's exception, I want to raise both a's exception and b's exce