Re: InstanceSigs -- rationale for the "must be more polymorphic than"

2021-09-20 Thread Merijn Verstraaten
> On 18 Sep 2021, at 04:29, Anthony Clayden wrote: > "InstanceSigs is a mis-feature. Don't use it. It is less confusing to just > give no signature at all. If you really, really want to bind tyvars, use > PatternSignatures." I would strongly disagree with this statement. I think instance

Re: InstanceSigs -- rationale for the "must be more polymorphic than"

2021-09-17 Thread Anthony Clayden
> If you would like to offer a patch for the user manual to explain this better, that would be great. Thank you Simon for the invitation. On further investigation https://gitlab.haskell.org/ghc/ghc/-/issues/20357, what I'd like the user manual to say is: "InstanceSigs is a mis-feature. Don't

Re: InstanceSigs -- rationale for the "must be more polymorphic than"

2021-08-10 Thread Anthony Clayden
mgu of the InstanceSig given with the substitution from the instance head & constraints. > > > *From:* Glasgow-haskell-users *On > Behalf Of *David Feuer > *Sent:* 08 August 2021 09:37 > *To:* Anthony Clayden > *Cc:* GHC users > *Subject:* Re: InstanceSigs -- rati

Re: InstanceSigs -- rationale for the "must be more polymorphic than"

2021-08-10 Thread David Feuer
; > > All in all, no big deal. Instance signature are a convenience, never a > necessity. > > > > If you would like to offer a patch for the user manual to explain this > better, that would be great. > > > > Simon > > > > *From:* Glasgow-haskell-users *On

RE: InstanceSigs -- rationale for the "must be more polymorphic than"

2021-08-10 Thread Simon Peyton Jones via Glasgow-haskell-users
August 2021 12:01 To: Simon Peyton Jones Cc: Anthony Clayden ; GHC users Subject: Re: InstanceSigs -- rationale for the "must be more polymorphic than" Simon, there are times when a function has to be generalized to be made polymorphic recursive. Perhaps the method takes an argument

Re: InstanceSigs -- rationale for the "must be more polymorphic than"

2021-08-10 Thread David Feuer
; better, that would be great. > > > > Simon > > > > *From:* Glasgow-haskell-users *On > Behalf Of *David Feuer > *Sent:* 08 August 2021 09:37 > *To:* Anthony Clayden > *Cc:* GHC users > *Subject:* Re: InstanceSigs -- rationale for the "must be more >

RE: InstanceSigs -- rationale for the "must be more polymorphic than"

2021-08-10 Thread Simon Peyton Jones via Glasgow-haskell-users
this better, that would be great. Simon From: Glasgow-haskell-users On Behalf Of David Feuer Sent: 08 August 2021 09:37 To: Anthony Clayden Cc: GHC users Subject: Re: InstanceSigs -- rationale for the "must be more polymorphic than" To the best of my knowledge, `InstanceSigs` are neve

Re: InstanceSigs -- rationale for the "must be more polymorphic than"

2021-08-08 Thread David Feuer
To the best of my knowledge, `InstanceSigs` are never strictly necessary. They can, however, be useful for at least four purposes: 1. To provide a compiler-checked reminder of the type. 2. To bind type variables with `ScopedTypeVariables`. 3. To generalize the type so you can use polymorphic

InstanceSigs -- rationale for the "must be more polymorphic than"

2021-08-08 Thread Anthony Clayden
I can't help but feel InstanceSigs are either superfluous or upside-down. It's this bit in the User Guide: > The type signature in the instance declaration must be > more polymorphic than (or the same as) the one in the class declaration, > instantiated with the instance type. Usually if you