nominolo at googlemail.com
Sun Nov 2 08:32:15 EST 2008
I think the best way to get backwards compatibility is to flesh out
and use the extensible-exceptions package that Ian started, which
models extensible exceptions on top of the old exception mechanism.
Alternatively, you can decide not to use extensible exceptions and
have your package depend on base-3 instead of base-4.
For a library, however, I don't think there's a good solution, since
most of the time changing the exception mechanism for the library will
make the library incompatible with existing clients. I guess the best
way to deal with this is to properly use the package versioning policy
and hope that clients specify their dependencies precisely.
2008/11/2 Sigbjorn Finne <sof at galois.com>:
> (+1) to that request - what is the "best practices" for portable exception
> handling code that straddles version 6.10, i.e. that compiles with compilers
> at either side with minimal fuss? I can imagine a couple of alternatives,
> would like to hear what others are doing here.
> --sigbjorn "likes backward code compatibility"
> On 11/1/2008 18:15, Jason Dagit wrote:
>> On Wed, Oct 8, 2008 at 1:19 AM, Simon Marlow <marlowsd at gmail.com> wrote:
>>> Johannes Waldmann wrote:
>>>> with 6.10, the following does not typecheck:
>>>> foo `Control.Exception.catch` \ _ -> return bar
>>>> Ambiguous type variable `e' in the constraint:
>>>> `Control.Exception.Exception e'
>>>> It is probably bad programming style anyway but what is the workaround?
>>> As long as you're aware that it is bad programming style. We
>>> didn't include an easy way to do this, because we want people to think
>>> why they need to catch *all* exceptions (most of the time it's a bug).
>> Since the above is bad form, what should I be doing? Could someone
>> please provide some examples or point me at the list of exceptions
>> that I can catch? What about catching multiple types of exceptions?
>> Glasgow-haskell-users mailing list
>> Glasgow-haskell-users at haskell.org
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
More information about the Glasgow-haskell-users