[Haskell] sugar for extensible types (was: class associated types, via GADTs.)

Remi Turk rturk at science.uva.nl
Wed Feb 16 15:12:50 EST 2005


On Wed, Feb 16, 2005 at 12:38:45PM -0000, Simon Marlow wrote:
> 
> test = do
>   x `catch` (\(IOException e)    -> print e)
>     `catch` (\(ArithException e) -> print e)

Although slightly off-topic, and though you probably already
realized it, beware that this is comparable to 

try {
	try {
		x
	} catch (IOException e) {
		print e
	}
} catch (ArithException e) {
	print e
}

instead of the usual

try {
	x
} catch (IOException e) {
	print e
} catch (ArithException e) {
	print e
}

which wasn't immediately obvious to me at first.

Groeten,
Remi

-- 
Nobody can be exactly like me. Even I have trouble doing it.


More information about the Haskell mailing list