[GHC] #15661: Nullary constraint in GHCi breaks `:t` command

GHC ghc-devs at haskell.org
Mon Oct 1 13:09:39 UTC 2018


#15661: Nullary constraint in GHCi breaks `:t` command
-------------------------------------+-------------------------------------
        Reporter:  taktoa            |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  GHCi              |              Version:  8.4.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 This behaviour is just what you'd expect.  Remember: `:type <expression>`
 takes an ''arbitrary expression'' (not just a variable), finds its most
 general type, and shows that type.  Here the expression happens to be just
 a single variable `x`.  Fine, so we instantiate `x`, which gives rise to a
 "wanted" `(Show Foo)`. Then we attempt to solve and generalise, but `(Show
 Foo)` is not soluble.  Hence the error.

 If you just want to see `x's` type, use `:info`, thus
 {{{
 ghci> :info x
 x :: Show Foo => ()     -- Defined at <interactive>:3:26
 }}}
 I think everything seems fine here.  But it clearly wasn't what you
 expected.  Does my explanation help?

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15661#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list