GHC: Ticket #7402: Warn about possible missing -XScopedTypeVariables on errors.
http://ghc.haskell.org/trac/ghc/ticket/7402
<p>
Suggest that the user they may wish to add -XScopedTypeVariables, if an error results from a free type variable which would be bound in its scope with the flag enabled. (i.e. if its name exists as a variable in the type declaration).
</p>
<p>
I ran into this problem on code similar to this:
</p>
<pre class="wiki">instance (Sized a n, Nat n) => Rep a where
emptyRep = replicate (toInt (undefined :: n)) 0
</pre><p>
and it took me some time to solve, and only by having vague knowledge that such a flag existed.
</p>
en-usGHChttp://ghc.haskell.org/trac/ghc/chrome/site/ghc_logo.png
http://ghc.haskell.org/trac/ghc/ticket/7402
Trac 1.0.7simonpjTue, 08 Jan 2013 14:11:10 GMTstatus changed; difficulty, resolution set
http://ghc.haskell.org/trac/ghc/ticket/7402#comment:1
http://ghc.haskell.org/trac/ghc/ticket/7402#comment:1
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>closed</em>
</li>
<li><strong>difficulty</strong>
set to <em>Unknown</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
</ul>
<p>
Good point. I've tightened up the ambiguity check for instance declarations. Now you'll get an "ambiguous declaration" error from the above.
</p>
<p>
Simon
</p>
TicketsimonpjTue, 08 Jan 2013 23:40:53 GMT
http://ghc.haskell.org/trac/ghc/ticket/7402#comment:2
http://ghc.haskell.org/trac/ghc/ticket/7402#comment:2
<p>
Actually I was mixed up. The ambiguity fix would reject this instance, but the original question was about scoped type variables. The trouble is that this is a perfectly legal program <em>without</em> scoped type variables, with the 'n' meaning "forall n. n". I'm not sure how to improve this.
</p>
<p>
Simon
</p>
Ticket