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

GHC ghc-devs at haskell.org
Fri Sep 1 18:20:26 UTC 2017


#14180: Strange/bad error message binding unboxed type variable
-------------------------------------+-------------------------------------
           Reporter:  dfeuer         |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.2.2
          Component:  Compiler       |           Version:  8.3
  (Type checker)                     |
           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:
-------------------------------------+-------------------------------------
 {{{#!hs
 {-# language TypeInType, TypeFamilies, MagicHash #-}

 import GHC.Exts

 type family MatchInt (f :: Int) :: () where
   MatchInt ('I# x) = '()
 }}}

 produces

 {{{
 <interactive>:2:59: error:
     • Couldn't match a lifted type with an unlifted type
       When matching kinds
         k0 :: *
         Int# :: TYPE 'IntRep
       Expected kind ‘Int#’, but ‘x’ has kind ‘k0’
     • In the first argument of ‘ 'I#’, namely ‘x’
       In the first argument of ‘MatchInt’, namely ‘( 'I# x)’
       In the type family declaration for ‘MatchInt’
 }}}

 If, however, I replace `x` in the pattern with `_`, the type checker is
 satisfied. If I give it a pattern signature,

 {{{#!hs
 MatchInt ('I# (x :: Int#)) = '()
 }}}

 I get a different (and equally unhelpful) error message,

 {{{
     • Expecting a lifted type, but ‘Int#’ is unlifted
     • In the kind ‘Int#’
       In the first argument of ‘ 'I#’, namely ‘(x :: Int#)’
       In the first argument of ‘MatchInt’, namely ‘( 'I# (x :: Int#))’
 }}}

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


More information about the ghc-tickets mailing list