[Haskell-cafe] what I learnt from my first serious haskell programm

Fawzi Mohamed fmohamed at mac.com
Tue Mar 20 07:10:12 EDT 2007


David House wrote:
> On 19/03/07, Fawzi Mohamed <fmohamed at mac.com> wrote:
>> Vectors don't act like numbers, a vector space is not a field, even if
>> they have some common operations.
>
> As I said in my previous email, this is because Num is too big. We
> need to split it down, but there's no sane way of doing this without
> your average numeric function needing about a thousand different
> constraints on it. Type class synonyms [1] look promising, but
> no-one's implemented them yet AFAIK.
>
> [1]: http://repetae.net/john/recent/out/classalias.html
>
I might missing something fundamental but what is the advantage of a 
class alias with respect to multiple inheritance?
i.e.
    class alias FooBar a = (Foo a, Bar a)
vs
    class (Foo a, Bar a) => FooBar

can an alias be implemented a posteriory without modifying the code of 
FooBar?
because what one really wants to do is to split Num even if Num is not 
splitted, but this would create problems with type inference...

Fawzi


More information about the Haskell-Cafe mailing list