Skip to content

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

Maybe indicative of deeper issues:

{-# 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>
Trac metadata
Trac field Value
Version 8.6.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information