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

GHC ghc-devs at haskell.org
Thu Sep 20 20:52:54 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
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 If you create a value whose type has a nullary constraint (i.e.: a
 constraint that does not reference any of the type variables in scope) and
 then try to run `:t` on it, GHCi attempts to run instance resolution and
 fails before printing the type.

 Expected output:

 {{{
 GHCi, version 8.4.3: http://www.haskell.org/ghc/  :? for help
 Prelude> :set -XFlexibleContexts
 Prelude> data Foo = Foo
 Prelude> let x :: (Show Foo) => () ; x = ()
 Prelude> :t x
 x :: Show Foo => ()
 }}}

 Actual output:

 {{{
 GHCi, version 8.4.3: http://www.haskell.org/ghc/  :? for help
 Prelude> :set -XFlexibleContexts
 Prelude> data Foo = Foo
 Prelude> let x :: (Show Foo) => () ; x = ()
 Prelude> :t x

 <interactive>:1:1: error:
     No instance for (Show Foo) arising from a use of ‘x’
 }}}

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


More information about the ghc-tickets mailing list