[GHC] #14366: Type family equation refuses to unify wildcard type patterns

GHC ghc-devs at haskell.org
Wed Oct 18 14:13:48 UTC 2017


#14366: Type family equation refuses to unify wildcard type patterns
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.2.1
  checker)                           |             Keywords:  TypeFamilies,
      Resolution:                    |  TypeInType
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 Contrast this with a similar type family declaration, which is rejected:

 {{{#!hs
 {-# LANGUAGE TypeFamilies #-}
 {-# LANGUAGE TypeInType #-}
 {-# LANGUAGE TypeOperators #-}

 import Data.Kind
 import Data.Type.Equality
 import GHC.TypeNats

 type family Cast (e :: a :~: b) (x :: a) (y :: b) :: Nat where
   Cast Refl (_ :: a) (_ :: b) = 42
 }}}
 {{{
 GHCi, version 8.2.1: 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:22: error:
     • Expected kind ‘a’, but ‘_’ has kind ‘b’
     • In the third argument of ‘Cast’, namely ‘(_ :: b)’
       In the type family declaration for ‘Cast’
    |
 10 |   Cast Refl (_ :: a) (_ :: b) = 42
    |                      ^^^^^^^^
 }}}

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


More information about the ghc-tickets mailing list