On 06/19/2015 08:44 AM, Sean Leather wrote:
Note this won't work for a Num instance mentioned earlier because the existentially quantified d types in two SC values are not provably the same type. In other words, you can't write

instance Num e => Show (S Num e) where
    SC x1 y1 + SC x2 y2 = SC (x1 + x2) (y1 + y2)

because x1 and x2 can have different types.
Another issue is: what if I want to constraint the type `e` to more classes and make `d` to have the same constrains? I have to re-declare the `S` data type like?:

data S c1 c2 ... cN e where
    SC :: (c1 d, c2 d, ..., cN d) -> d -> e -> S c1 c2 ... cN e

Does anyone ever needed such a feature?
-- 
Leza Morais Lutonda, Lemol-C
http://lemol.github.io
Untitled Document

50 Aniversario de la Cujae. Inaugurada por Fidel el 2 de diciembre de 1964 http://cujae.edu.cu