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

GHC ghc-devs at haskell.org
Wed Nov 7 17:51:44 UTC 2018


#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


More information about the ghc-tickets mailing list