[Haskell-cafe] OverlappingInstances-extension-like for type families

Leza Morais Lutonda leza.ml at fecrd.cujae.edu.cu
Wed Jul 23 21:55:17 UTC 2014


On 22/07/14 14:02, adam vogt wrote:
> Hi Leza,
>
> I believe those instances are accepted in ghc-7.6. In future ghcs, it
> looks like there will be an extension that allows them again:
> https://phabricator.haskell.org/D69
>
> In the meantime you could add another parameter for the 'e':
>
> class Complexable csx rsx cel rel e | cel → csx, rel → rsx, e rsx →
> csx, csx -> e
> instance (RealFloat e) ⇒ Complexable [C e] [e] (C e) e e
> instance (RealFloat e) ⇒ Complexable [C e] [C e] (C e) (C e) e
>
>
> Or you could keep the Complexable class as you had it, but write the
> instances for particular 'e' like:
>
> instance Complexable [C Double] [Double] (C Double) Double
>
>
> Regards,
> Adam
>

Ok Adam,
I read more about this situation with type families and functional 
dependencies, and hope it will come soon to ghc.
Meantime I will stay with type families and not to have  these two 
instances simultaneously.

Thanks.

-- 
Leza Morais Lutonda, Lemol-C
http://lemol.github.io



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




More information about the Haskell-Cafe mailing list