| > I can then say:
| > 
| > > bar :: C a => a -> Int
| > > bar (x :: a) = foo (undefined :: a)
| > 
| > But not:
| > 
| > > bar :: C a => a -> Int
| > > bar x = foo (undefined :: a)
| > 
| > because it tries to use a new scope for the type variable a and 
| > doesn't unify it with the one in the type spec.  Why not?
| 
| I don't know why it isn't the case in Haskell.
| In Mercury we do allow type variables in function type 
| declarations to scope over explicit type qualifications in 
| clause bodies.

It's a deliberate design choice, but certainly only one of taste.
It seems a bit odd for a type signature (perhaps separated by a long
way from the definition) should bind a type variable that scopes over
the function body.  

Mark Shields and I are writing a paper about the scoped-type-variable
design in GHC; we'll discuss this point.

Simon

_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to