Partial type sigs
Simon Peyton Jones
simonpj at microsoft.com
Wed Feb 4 20:24:10 UTC 2015
Thomas
I was looking at Trac #10045<http://ghc.haskell.org/trac/ghc/ticket/10045>. I know exactly what is going on, but my investigation triggered several questions.
1. What is the state of the ToDos on https://ghc.haskell.org/trac/ghc/wiki/PartialTypeSignatures?
2. Is a named wildcard supposed to have any scope? For example:
f :: _a -> b -> _a
f x y = x :: _a
The _a in the signature is not supposed to have any lexical scope over the binding is it? That would be entirely inconsistent with the treatment of ordinary type variables (such as 'b' in the example) which only scope if you have an explicit 'forall b'.
Assuming the answer is "no" (and I really think it should be no), what is the call to tcExtendTyVarEnv2 tvsAndNcs doing in TcBinds.tcRhs? I'm pretty certain it bring into scope only the sig_tvs, and NOT the sig_nwcs.
3. If that is true, I think we may not need the sig_nwcs field of TcSigInfo at all.
4. A TcSigInfo has a sig_id field, which is intended to give the fixed, fully-known polymorphic type of the function. This is used:
* for polymorphic recursion
* as the type of the function to use in the body of the let, even if typechecking the function itself fails.
Neither of these makes sense for partial type sigs. (And in fact, using sig_id for a partial type sig is what gives rise to #10045.) So I'm pretty convinced that we should replace sig_id and sig_partial with a single field sig_id :: Maybe Id, which is Nothing for partial sigs, and (Just ty) for total sigs.
I wanted to check with you before blundering in and doing this. Or you could.
RSVP
Thanks
Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20150204/b2bb59bc/attachment.html>
More information about the ghc-devs
mailing list