Potentially confusing syntax for injective type families

Jan Stolarek jan.stolarek at p.lodz.pl
Sun Feb 14 09:28:46 UTC 2016


> 2. Without the infectivity annotation, this declares an associate type
> synonym default. This isn't valid because Ht is not declared as an
> associated type before hand and r is not mentioned on the LHS.
>
> class Hcl a b where
>     type Ht a b = r
Indeed, this is invalid and GHC rejects this, so I think we're OK here. In case of associated 
types if you want to declare injectivity you need to provide the "| r -> ...." part. Otherwise 
you're declaring a default. This is documented in the User's Guide for 8.0.

Janek

---
Politechnika Łódzka
Lodz University of Technology

Treść tej wiadomości zawiera informacje przeznaczone tylko dla adresata.
Jeżeli nie jesteÅ›cie PaÅ„stwo jej adresatem, bÄ
dź otrzymaliÅ›cie jÄ
 przez pomyłkę
prosimy o powiadomienie o tym nadawcy oraz trwałe jej usunięcie.

This email contains information intended solely for the use of the individual to whom it is addressed.
If you are not the intended recipient or if you have received this message in error,
please notify the sender and delete it from your system.


More information about the ghc-devs mailing list