
On Fri, May 04, 2001 at 07:56:24PM +0000, Marcin 'Qrczak' Kowalczyk wrote:
I would like to make pattern and result type signatures one-way matching, like in OCaml: a type variable just gives a name to the given part of the type, without constraining it any way - especially without "negative constraining", i.e. without yielding an error if it will be known more than that it's a possibly constrained type variable...
I'm not sure I understand here. One thing that occurred to me reading your e-mail was that maybe the implicit universal quantification over type variables is a bad idea, and maybe type variables should, by default, have pattern matching semantics. Whether or not this is a good idea abstractly, the way I imagine it, it would make almost all existing Haskell code invalid, so it can't be what you're proposing. Are you proposing that variables still be implicitly quantified in top-level bindings, but that elsewhere they have pattern-matching semantics? Best, Dylan Thurston

Fri, 4 May 2001 16:16:29 -0400, Dylan Thurston
I'm not sure I understand here. One thing that occurred to me reading your e-mail was that maybe the implicit universal quantification over type variables is a bad idea, and maybe type variables should, by default, have pattern matching semantics.
Only for type signatures on patterns and results. It's a ghc/Hugs extension. You can write: f' arr :: ST s (a i e) = do (marr :: STArray s i e) <- thaw arr ... These type variables have the same scope as corresponding value variables. The s,i,e in the type of marr refer to the corresponding variables from the result of f'. You could bind i,e to new names in marr, but not s. (Well, now I'm not sure why there is a difference...) Type variables from the head of a class are also available in the class scope in ghc. You use bound type variables in ordinary type signatures on expressions and let-bound variables in their scope. Unbound type variables in these places are implicitly qualified by forall, I don't want to change this. Some people think that type variables used in standard type signatures (expressions and let-bound variables) should be available in the appropriate scope. I don't have a strong opinion on that. -- __("< Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/ \__/ ^^ SYGNATURA ZASTÊPCZA QRCZAK
participants (2)
-
Dylan Thurston
-
Marcin 'Qrczak' Kowalczyk