[GHC] #14238: `:kind` suppresses visible dependent quantifiers by default in GHCi 8.2.1

#14238: `:kind` suppresses visible dependent quantifiers by default in GHCi 8.2.1 -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 (Type checker) | Keywords: TypeInType | Operating System: Unknown/Multiple Architecture: | Type of failure: Incorrect result Unknown/Multiple | at runtime Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Load this program into GHCi on 8.2.1 or later: {{{#!hs {-# LANGUAGE GADTs #-} {-# LANGUAGE TypeInType #-} import Data.Kind data Foo (k :: Type) :: k -> Type where MkFoo :: Foo (k1 -> k2) f -> Foo k1 a -> Foo k2 (f a) }}} And ask it what the kind of `Foo` is: {{{ GHCi, version 8.2.1: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/rgscott/.ghci [1 of 1] Compiling Main ( Bug.hs, interpreted ) Ok, 1 module loaded. λ> :k Foo Foo :: k -> * }}} This is just plain wrong: the actual kind of `Foo` should be `forall k -> k -> *`. Normally, one can omit `forall`s from a kind signature, but this is a special case where we're using a //visible// forall. In other words, `forall k -> k -> *` is not the same as `k -> *`, as the former takes two arguments, whereas the latter takes one. A workaround is to force GHCi to come to its senses by explicitly enabling `-fprint-explicit-foralls`: {{{ λ> :set -fprint-explicit-foralls λ> :k Foo Foo :: forall k -> k -> * }}} This is actually a regression since GHC 8.0.2, since GHCi did the right thing by default then: {{{ GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/rgscott/.ghci [1 of 1] Compiling Main ( Bug.hs, interpreted ) Ok, modules loaded: Main. λ> :k Foo Foo :: forall k -> k -> Type }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14238 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14238: `:kind` suppresses visible dependent quantifiers by default in GHCi 8.2.1 -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.2.1 checker) | Resolution: | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): I agree! For terms we have a difference between `:info` (which takes a name) and `:type` (which takes an expression, and may involve instantiating and re- generalising). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14238#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14238: `:kind` suppresses visible dependent quantifiers by default in GHCi 8.2.1 -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.2.1 checker) | Resolution: | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): Agreed as well. The ticket has TypeInType on it already, and so I'll get to it in due course, unless someone grabs it sooner. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14238#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14238: `:kind` suppresses visible dependent quantifiers by default in GHCi 8.2.1 -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler (Type | Version: 8.2.1 checker) | Resolution: | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4564 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => patch * differential: => Phab:D4564 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14238#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14238: `:kind` suppresses visible dependent quantifiers by default in GHCi 8.2.1
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: (none)
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Compiler (Type | Version: 8.2.1
checker) |
Resolution: | Keywords: TypeInType
Operating System: Unknown/Multiple | Architecture:
Type of failure: Incorrect result | Unknown/Multiple
at runtime | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D4564
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ryan Scott

#14238: `:kind` suppresses visible dependent quantifiers by default in GHCi 8.2.1 -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.6.1 Component: Compiler (Type | Version: 8.2.1 checker) | Resolution: fixed | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Incorrect result | Test Case: at runtime | dependent/ghci/T14238 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4564 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: patch => closed * testcase: => dependent/ghci/T14238 * resolution: => fixed * milestone: => 8.6.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14238#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC