
When this was first discussed a bunch of alternatives were tossed around, mostly involving new keywords, or putting a conditional result keyword in place. Here you can pick the name of the result type, so it doesn't pick any naming conventions for you. My understanding is that the current syntax was selected because it avoids magic conditional keywords and fits into a gap in the current grammar. All of the alternatives seemed worse. -Edward On Sun, Feb 14, 2016 at 5:56 AM, Matthew Pickering < matthewtpickering@gmail.com> wrote:
I guess my point is that the most natural parsing of
class Hcl a b where type Ht a b = r | r -> a b
is (type Ht a b = r) (| r -> a b) rather than (type Ht a b) (= r | r -> a b).
A concrete example, in the case of functional dependencies, the vertical bar is used to signal what we expect *additional* optional information. In this case, adding the injectivity annotation completely changes the meaning of what came before.
I don't have a solution and I hate bike-shedding. I just made this message to make sure the fact had been considered before release.
Matt
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
On Sun, Feb 14, 2016 at 9:28 AM, Jan Stolarek
wrote: 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.
ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs