Alex Ferguson wrote:
> Hi Jeff.
>
> > > http://www.cs.chalmers.se/~rjmh/Haskell/Messages/Display.cgi?id=274
> > >
> > > I think "A" is fine, it's "B" (and hence, SPJ's Composite Motion, A+B)
> > > that worries me, for the reasons I alluded to. If "beefed up A"
> > > does the job, I'm equally happy as with a more conservation syntax for
> > > "B".
>
> > Just as a sanity check, following an augmented proposal "A" where we can also
> > annotate the return type as well, consider these:
> >
> > f :: a -> (a -> a) -> a
> > f x = \g -> (g :: a -> a) x
> >
> > f (x :: a) :: (a -> a) -> a = \g -> (g :: a -> a) x
> >
> > Which of these two is correct, and why? Why not both?
>
> Under "A+B", these would be equivalent. Under "A++" (Mark's original
> "A", only, plus the return types), the second of these is "correct"
> (assuming a restricted interpretation of "a" is what was intended), but
> in the first, the a's in sig and body are bound quite separately, so the
> local type annotation would be too general.
>
I'm not sure what the parenthetical comment about the interpretation of a means -
take the definition at face value.
I should have been more explicit - I'm interested not in why the first one would
be incorrect, but how, for example, you would explain that to someone learning
Haskell. It's not at all clear to me that people should expect the a's to be
different - I can't think of a good rationale for it (aside from the "don't break
old code" argument, which, if that's the only argument, doesn't seem strong enough
to me).
--Jeff