
7 Jul
2008
7 Jul
'08
9:56 a.m.
On Mon, 7 Jul 2008, Daniel Yokomizo wrote:
Exceptions as part of the types are a good idea but can become problematic:
(.) :: (b -> c throws x) -> (a -> b throws y) -> (a -> c throws x + y)
You mean (Control.Arrow.<<<) ? :-)
This kind of signature is the only correct way to express this without losing information, but it requires some way to encode the typed union without creating too complicated types.
(Control.Arrow.<<<) also answers the question for an appropriate type signature: All involved actions must use the same exception type. If the types mismatch, it would be easy to convert exceptions of different types to a unifying type.