# Arrow Classes

**Ashley Yakeley
**
ashley@semantic.org

*Sat, 12 Jul 2003 03:41:59 -0700*

In article <200307121058.21556.alastair@reid-hoffmann.net>,
Alastair Reid <alastair@reid-hoffmann.net> wrote:
>* One way to overcome part of this problem would be to generalize the idea of
*>* 'type synonyms' to allow 'context synonyms'. For example, we have type
*>* synonyms like:
*>*
*>* type Point = (Int,Int)
*>*
*>* we could have 'context synonyms' like:
*>*
*>* class Num a => (Add a, Subtract a, FromInteger a, Eq a, Multiply a, ...)
*
That would be quite unnecessary. Simply write this:
class (Add a, Subtract a, FromInteger a, Eq a, Multiply a, ...) =>
Num a;
instance (Add a, Subtract a, FromInteger a, Eq a, Multiply a, ...) =>
Num a;
And now you can write this:
invert :: Num a => Matrix a -> Matrix a
I use this idiom quite frequently for "joining" classes together.
--
Ashley Yakeley, Seattle WA