[GHC] #15872: Odd pretty printing of equality constraint in kind ('GHC.Types.Eq# <>)

#15872: Odd pretty printing of equality constraint in kind ('GHC.Types.Eq# <>) -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Poor/confusing Unknown/Multiple | error message Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Maybe indicative of deeper issues: {{{#!hs {-# Language RankNTypes #-} {-# Language DataKinds #-} {-# Language PolyKinds #-} {-# Language GADTs #-} import Data.Kind data WHICH = OP | OPOP data Fun :: forall (a :: WHICH). a ~ OP => Type -> Type -> Type where MkFun :: (a -> b) -> Fun a b }}} There are some artifacts `Fun ('GHC.Type.Eq# <>)` in the type of `MkFun` that shouldn't be there {{{ $ ~/code/unmodifiedghc/inplace/bin/ghc-stage2 --interactive -ignore-dot- ghci ~/hs/655_bug.hs GHCi, version 8.7.20181029: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Main ( /home/baldur/hs/655_bug.hs, interpreted ) Ok, one module loaded. *Main> :t MkFun MkFun :: (a -> b) -> Fun ('GHC.Types.Eq# <>) a b *Main> :k Fun Fun :: (a ~ 'OP) => * -> * -> * *Main> }}} ---- Tangent: Omitting `{-# Language GADTs #-}` we get the term "equational constraint" which is not the term I have seen in the wild {{{ $ latestbug 655_bug.hs GHCi, version 8.7.20181017: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Main ( 655_bug.hs, interpreted ) 655_bug.hs:9:1: error: Illegal equational constraint a ~ 'OP (Use GADTs or TypeFamilies to permit this) | 9 | data Fun :: forall (a :: WHICH). a ~ OP => Type -> Type -> Type where | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^... Failed, no modules loaded. Prelude> }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15872 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15872: Odd pretty printing of equality constraint in kind ('GHC.Types.Eq# <>) -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.2 Resolution: | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by goldfire): * keywords: => TypeInType -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15872#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15872: Odd pretty printing of equality constraint in kind ('GHC.Types.Eq# <>) -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.2 Resolution: | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: #13933 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * related: => #13933 Comment: See #13933 for another way to trigger the pretty-printing oddities uncovered here. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15872#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15872: Odd pretty printing of equality constraint in kind ('GHC.Types.Eq# <>) -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.2 Resolution: | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: #13933 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): I wonder if these `('GHC.Types.Eq# <>)` coercion arguments should just be suppressed by default unless `-fprint-explicit-coercions` is enabled? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15872#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15872: Odd pretty printing of equality constraint in kind ('GHC.Types.Eq# <>) -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.2 Resolution: | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: #13933 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): In GHC HEAD (as of commit 2257a86daa72db382eb927df12a718669d5491f8), you get the following error when compiling the original program: {{{ GHCi, version 8.7.20181129: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/rgscott/.ghci [1 of 1] Compiling Main ( ../Bug.hs, interpreted ) ../Bug.hs:10:1: error: • Illegal constraint in a kind: forall (a :: WHICH). (a ~ 'OP) => * -> * -> * • In the data type declaration for ‘Fun’ | 10 | data Fun :: forall (a :: WHICH). a ~ OP => Type -> Type -> Type where | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^... }}} Which would suggest that this issue is now moot. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15872#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15872: Odd pretty printing of equality constraint in kind ('GHC.Types.Eq# <>) -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.6.2 Resolution: | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: #12102, #13933 | Differential Rev(s): Phab:D5397 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => patch * differential: => Phab:D5397 * related: #13933 => #12102, #13933 Comment: Phab:D5397 wraps things up by removing the outdated users' guide text about this feature, and adding a regression test. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15872#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15872: Odd pretty printing of equality constraint in kind ('GHC.Types.Eq# <>)
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner: (none)
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Compiler | Version: 8.6.2
Resolution: | Keywords: TypeInType
Operating System: Unknown/Multiple | Architecture:
Type of failure: Poor/confusing | Unknown/Multiple
error message | Test Case:
Blocked By: | Blocking:
Related Tickets: #12102, #13933 | Differential Rev(s): Phab:D5397
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ryan Scott

#15872: Odd pretty printing of equality constraint in kind ('GHC.Types.Eq# <>) -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.6.2 Resolution: fixed | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Poor/confusing | Test Case: error message | typecheck/should_fail/T12102 Blocked By: | Blocking: Related Tickets: #12102, #13933 | Differential Rev(s): Phab:D5397 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * testcase: => typecheck/should_fail/T12102 * status: patch => closed * resolution: => fixed * milestone: => 8.8.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15872#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15872: Odd pretty printing of equality constraint in kind ('GHC.Types.Eq# <>) -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.2 Resolution: | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Poor/confusing | Test Case: error message | typecheck/should_fail/T12102 Blocked By: | Blocking: Related Tickets: #12102, #13933 | Differential Rev(s): Phab:D5397 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: closed => new * resolution: fixed => * milestone: 8.8.1 => Comment: Commit [https://gitlab.haskell.org/ghc/ghc/commit/6cce36f83aec33d33545e0ef2135894d22... 6cce36f83aec33d33545e0ef2135894d22dff5ca] (`Add AnonArgFlag to FunTy`) added back the ability to have equality constraints in kinds. Unfortunately, the issues in the original description persist: {{{ GHCi, version 8.9.20190224: https://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/rgscott/.ghci [1 of 1] Compiling Main ( Bug.hs, interpreted ) Ok, one module loaded. λ> :i MkFun type role Fun nominal representational representational data Fun (a1 :: a ~ 'OP) b c where MkFun :: b -> c -> Fun 'GHC.Types.Eq# <> b c -- Defined at Bug.hs:11:3 λ> :k Fun Fun :: (a ~ 'OP) -> * -> * -> * }}} In fact, the situation is arguably //worse// now, since `:k Fun` reports the entirely bogus kind `Fun :: (a ~ 'OP) -> * -> * -> *`. (See also #12102.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15872#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15872: Odd pretty printing of equality constraint in kind ('GHC.Types.Eq# <>) -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.2 Resolution: | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Poor/confusing | Test Case: error message | typecheck/should_fail/T12102 Blocked By: | Blocking: Related Tickets: #12102, #13933, | Differential Rev(s): Phab:D5397 #16263 | Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * related: #12102, #13933 => #12102, #13933, #16263 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15872#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC