Arrow Classes
Raja R Harinath
harinath@cs.umn.edu
Sat, 12 Jul 2003 08:26:54 -0500
Alastair Reid <alastair@reid-hoffmann.net> writes:
>> I'm glad to hear there isn't a _serious_ cost (i.e. performance penalty)
>> for fine-grained hierarchies.
>
> One cost which doesn't seem to have been mentioned is the programmer cost.
>
> With the current Haskell Prelude, a matrix operation (say) might have type:
>
> invert :: Num a => Matrix a -> Matrix a
>
> but, if we had one operation per class, the type might be:
>
> invert :: (Add a, Subtract a, FromInteger a, Eq a, Multiply a)
> => Matrix a -> Matrix a
>
> More flexible but quite unwieldy.
IIRC, Clean essentially has this. Though it's more like
invert :: (+ a, - a, FromInteger a, = a, * a) => Matrix a -> Matrix a
(I may be wrong about the syntax and the specifics :-)
- Hari
--
Raja R Harinath ------------------------------ harinath@cs.umn.edu