Alex Ferguson wrote:
> > I think the way that Hugs 1.3c handles it would meet your goals. All that
> > it requires is a strict extension to the syntax for patterns to allow type
> > annotations. These can be useful in their own right, but also can be
> > applied to problems like the one that you gave:
> >
> > f :: [a] -> a -> [a]
> > f ((x::a):xs) y = g y
> > where
> > g :: a -> [a]
> > g q = [x,q]
>
> AKA "Proposal A" in SPJ's recent message on this topic:
>
> 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?
Next check. Consider these:
f g = ... (g :: a -> a) ...
f (g :: a -> a) = ... g ...
Which of these is correct, and why? Why not both?
--Jeff