Hello,

On 4/25/05, Andrew Pimlott <[EMAIL PROTECTED]> wrote:
> I appreciated your explanation, but can you also address (to the list)
> the last case given by the original poster?
> 
> > On 4/25/05, Andreas Rossberg <[EMAIL PROTECTED]> wrote:
> > > in particular, when I compare with the single parameter case:
> > >
> > >    class C a where fc :: a -> a -> ()
> > >
> > >    c1 x = let p = fc x in ()
> > >    c2 x = let p y = fc x y in ()
> > >
> > > where
> > >
> > >    c1 :: C a => a -> ()
> > >    c2 :: C a => a -> ()
> > >
> > > is inferred, as I would expect.

The inference steps for this case are much the same except, that the
inferred type for "p" now will be: "a -> ()", provided that we can
solve the constraint "C a".  Because we have assumptions about "a" in
the environment (namely it is mentioned in the type of the varible
"x") we cannot generalize the type of "p".  It therefore remains
monomorphic, and the constraint "C a" is propagated to the type of
"c2".

-Iavor
_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to