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

2021-08-10 Thread Anthony Clayden
On Tue, 10 Aug 2021 at 21:15, Simon Peyton Jones wrote: > > > I think you see why the instance sig must be at least as polymorphic ... > Thanks Simon, I do now see, but I'd have to say there's a heck of lot of questions on StackOverflow (most not from me) being surprised/asking why. See more

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

2021-08-10 Thread David Feuer
Ah, I see. Yes, you're right. Sorry. On Tue, Aug 10, 2021, 3:15 PM Simon Peyton Jones wrote: > Do you have a concrete example? > > > > I think that the recursive calls will all go via the original class method > with its original type – we can’t know that it’s calling **this** > instance till

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

2021-08-10 Thread Simon Peyton Jones via Glasgow-haskell-users
Do you have a concrete example? I think that the recursive calls will all go via the original class method with its original type - we can't know that it's calling *this* instance till much later. So I still don't get it. An example would clear it up. Simon From: David Feuer Sent: 10

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

2021-08-10 Thread David Feuer
Simon, there are times when a function has to be generalized to be made polymorphic recursive. Perhaps the method takes an argument of type x (not a class parameter), but to call itself, it needs to be able to take types x, T x, T (T x), etc. That additional polymorphism can be introduced in the

RE: -dinline-check for symbolic names?

2021-08-10 Thread Simon Peyton Jones via Glasgow-haskell-users
It's hard to tell what is happening without a repro case. Can you share one? You suggested that it might have something to do with using an operator. Does the same thing happen if you replace the operator with an alpha-numeric name? Simon | -Original Message- | From:

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

2021-08-10 Thread Simon Peyton Jones via Glasgow-haskell-users
AntC, I think you see why the instance sig must be at least as polymorphic than the instantiated signature from the class - because that's what the client is going to expect. We are building a record of functions, and they must conform to the class signature. I agree with David's (1) and (2)