GHC: Ticket #8137: Permited mega-polymorphic type
http://ghc.haskell.org/trac/ghc/ticket/8137
<p>
Mega-polymorphic type!
This looks like a bug, but may be it is a feature
</p>
<pre class="wiki">u = u
b = u 2 + u "extra" "poly" "arguments" True
b' = u ++ u True
eq' = (u :: Bool) == (u 3.14 :: Bool)
eq'' = (u 1 :: Num t => t) == (u "strings" "a lot" :: Num z => z)
eq = u == u 2 -- ghci only
> :t u
u :: t
</pre><p>
This code is valid for <a class="wiki" href="http://ghc.haskell.org/trac/ghc/wiki/TypeChecker">TypeChecker</a>
</p>
en-usGHChttp://ghc.haskell.org/trac/ghc/chrome/site/ghc_logo.png
http://ghc.haskell.org/trac/ghc/ticket/8137
Trac 1.0.9goldfireThu, 15 Aug 2013 19:00:12 GMTstatus changed; resolution set
http://ghc.haskell.org/trac/ghc/ticket/8137#comment:1
http://ghc.haskell.org/trac/ghc/ticket/8137#comment:1
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>invalid</em>
</li>
</ul>
<p>
This is correct behavior. The definition of <tt>u</tt> means both that computing <tt>u</tt> will never terminate and that <tt>u</tt> has any type. The expressions that you have above will all run forever, because <tt>u</tt> will run forever.
</p>
TicketwvvThu, 15 Aug 2013 19:21:33 GMT
http://ghc.haskell.org/trac/ghc/ticket/8137#comment:2
http://ghc.haskell.org/trac/ghc/ticket/8137#comment:2
<p>
May be I misunderstood, it looks like this case is a part of 'infinite type':
</p>
<pre class="wiki">> let u x = (x,u)
<interactive>:33:14:
Occurs check: cannot construct the infinite type:
t1 = t0 -> (t0, t1)
In the expression: u
In the expression: (x, u)
In an equation for `u': u x = (x, u)
</pre>
TicketgoldfireFri, 16 Aug 2013 02:48:31 GMT
http://ghc.haskell.org/trac/ghc/ticket/8137#comment:3
http://ghc.haskell.org/trac/ghc/ticket/8137#comment:3
<p>
In the scenario in your comment above, the type <tt>t1</tt> must be a sub-part of the type <tt>t1</tt>, which is only possible with infinite types. In the original case in the bug report, we get the equation <tt>t = t</tt>, where <tt>t</tt> is the type of <tt>u</tt>, which is satisfiable for any type.
</p>
TicketcarterSun, 18 Aug 2013 01:10:58 GMT
http://ghc.haskell.org/trac/ghc/ticket/8137#comment:4
http://ghc.haskell.org/trac/ghc/ticket/8137#comment:4
<p>
indeed.
</p>
<p>
Wvv, please direct your type system dialogues to #haskell, the haskell-cafe mailing lists, related community fora. You're still learning about type theory, and while the interest is appreciated, ghc trac isn't the appropriate forum for that.
</p>
<p>
thanks
</p>
<p>
-Carter
</p>
Ticket