Nullary constraint in GHCi breaks `:t` command
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’
Trac metadata
Trac field | Value |
---|---|
Version | 8.4.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | GHCi |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |