[GHC] #13407: Fix printing of higher-rank kinds

#13407: Fix printing of higher-rank kinds -------------------------------------+------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Keywords: TypeInType | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Witness this GHCi session: {{{ rae:09:18:37 ~/ghc/ghc> ghci -ignore-dot-ghci GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help Prelude> :set -XTypeInType -XRankNTypes Prelude> import Data.Kind Prelude Data.Kind> data Foo :: (* -> *) -> (forall k. k -> *) Prelude Data.Kind> :info Foo type role Foo phantom nominal phantom data Foo (a :: * -> *) k (c :: k) -- Defined at <interactive>:3:1 }}} The output from `:info` is terrible, treating `k` as a visible parameter when it isn't. This is spun off from #13399 but is not tightly coupled to that ticket. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13407 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13407: Fix printing of higher-rank kinds -------------------------------------+------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: TypeInType 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 Iceland_jack): May relate to #12102, according to Ryan. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13407#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13407: Fix printing of higher-rank kinds -------------------------------------+------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: TypeInType 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 RyanGlScott): Another higher-rank kind pretty-printing oddity: {{{#!hs {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeInType #-} module Bug where import Data.Kind type family Foo (a :: Type) :: Type type instance Foo (a :: forall k. k -> Type) = Int }}} {{{ GHCi, version 8.2.0.20170523: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/rgscott/.ghci [1 of 1] Compiling Bug ( Bug.hs, interpreted ) Bug.hs:9:19: error: • Expecting one more argument to ‘a k1’ Expected a type, but ‘a k1’ has kind ‘k1 -> *’ • In the first argument of ‘Foo’, namely ‘(a :: forall k. k -> Type)’ In the type instance declaration for ‘Foo’ | 9 | type instance Foo (a :: forall k. k -> Type) = Int | ^^^^^^^^^^^^^^^^^^^^^^^^^^ }}} The error message mentions `a k1`... how did that `k1` sneak in there? I'm not sure if it's due to the same root cause as the original issue, but thought it was worth mentioning. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13407#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13407: Fix printing of higher-rank kinds -------------------------------------+------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: TypeInType 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): Remember that teh arguments in a type instance are types, not type variables. So when you write {{{ type instance Foo (a :: forall k. k-> TYpe) = ... }}} GHC treats it much like {{{ -- Suppose T :: forall k. k -> Type type instance Foo T = ... }}} It'll instantaite `T`'s kind to give `T k1` (where `k1` is a unification variable. Then it'll to unify `k1->Type` with the expected argument kind of `F`, namely `Type`. Hence the error mesage. Th eoddity is that it prints `a k1` rather than just `a` even without `fprint-explicit-kinds`. I expect that's because the head isn't at type constructor, but rather a type variable -- a pretty-printing bug. But a palpable bug, I think. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13407#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13407: Fix printing of higher-rank kinds
-------------------------------------+-------------------------------------
Reporter: goldfire | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Resolution: | Keywords: TypeInType
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 Ben Gamari

#13407: Fix printing of higher-rank kinds -------------------------------------+------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.0.1 Resolution: fixed | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => closed * resolution: => fixed * milestone: => 8.4.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13407#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC