[GHC] #14180: Strange/bad error message binding unboxed type variable

GHC ghc-devs at haskell.org
Tue Aug 21 14:46:40 UTC 2018


#14180: Strange/bad error message binding unboxed type variable
-------------------------------------+-------------------------------------
        Reporter:  dfeuer            |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.2.3
       Component:  Compiler (Type    |              Version:  8.3
  checker)                           |
      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):

 As far as why this error even happens in the first place, there appears to
 be some strangeness in the way the kind of the arrow `(->)` type
 constructor is generalized in type families. For example, this does not
 kind-check:

 {{{#!hs
 {-# LANGUAGE MagicHash #-}
 {-# LANGUAGE TypeFamilies #-}
 {-# LANGUAGE TypeInType #-}
 {-# LANGUAGE TypeOperators #-}
 module Bug where

 import Data.Kind
 import GHC.Exts (Int#, TYPE)

 type family F :: Int# -> Int
 }}}
 {{{
 Bug2.hs:10:18: error:
     • Expecting a lifted type, but ‘Int#’ is unlifted
     • In the kind ‘Int# -> Int’
    |
 10 | type family F :: Int# -> Int
    |                  ^^^^
 }}}

 However, one can work around the issue by defining one's own function
 type:

 {{{#!hs
 type Arrow = ((->) :: TYPE p -> TYPE q -> Type)
 type family F :: Int# `Arrow` Int
 }}}

 This leads me to wonder: what's the point of not generalizing the kind of
 `(->)` to be the same as `Arrow`, then?

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14180#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list