[GHC] #11511: Type family producing infinite type accepted as injective

GHC ghc-devs at haskell.org
Sat Dec 10 05:01:56 UTC 2016


#11511: Type family producing infinite type accepted as injective
-------------------------------------+-------------------------------------
        Reporter:  jstolarek         |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.1
  checker)                           |             Keywords:  TypeFamilies,
      Resolution:                    |  Injective
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 rwbarton):

 I imagine you have some examples where you need the recursive assumption.
 For a boring example, imagine converting one (promoted) unary natural
 number type `data N1 = Z1 | S1 N1` to another `data N2 = Z2 | S2 N2`:
 {{{
 type family F (a :: N1) :: N2 where
   F Z1 = Z2
   F (S1 n) = S2 (F n)
 }}}
 That is injective but you need to use the injectivity inductively to prove
 it.

 The original example seems fine to me, since you can't prove `F Bool ~ F
 Char` (you would need both the "infinite type" `[[[...]]]` and an
 infinitely long proof in order to do so).

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


More information about the ghc-tickets mailing list