Vag wrote:
>why
>
>Start = (C (D '1'),C (D 1))
>:: D a = D a
>instance C (D Int) where C _ = 2
>instance C (D Char) where C _ = 1
>class C a :: a -> Int
>
>does not work (`multiply defined`),

This is correct, only one instance for type D is allowed.

> but
>
>Start = (C (D '1'),C (D 1))
>:: D a = D a
>:: T :== D Char
>instance C (D Int) where C _ = 2
>instance C T where C _ = 1
>class C a :: a -> Int
>
>works ok (1,2)?

No, this should be rejected by the compiler. Detecting overlapping
instances does not work correctly if type synonyms are used in
the type of an instance.


>_______________________________________________
>clean-list mailing list
>[email protected]
>http://mailman.science.ru.nl/mailman/listinfo/clean-list

_______________________________________________
clean-list mailing list
[email protected]
http://mailman.science.ru.nl/mailman/listinfo/clean-list

Reply via email to