[GHC] #12199: GHC is oblivious to injectivity when solving an equality constraint (was: GHC is oblivious to injectivity when a type family is used in a GADT type)

GHC ghc-devs at haskell.org
Fri Jun 17 12:17:26 UTC 2016


#12199: GHC is oblivious to injectivity when solving an equality constraint
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.0.1
  checker)                           |             Keywords:  TypeFamilies,
      Resolution:                    |  Injective
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):

 [https://www.reddit.com/r/haskell/comments/4oeidw/type_family_dependencies_and_gadts/d4cgnq3
 gelisam points out] an even simpler failing example that doesn't involve
 GADTs. Even worse, it's cited as an example that should typecheck from
 section 5.3 of the [http://ics.p.lodz.pl/%7Estolarek/_media/pl:research
 :stolarek_peyton-jones_eisenberg_injectivity_extended.pdf original
 injective type families paper]!

 {{{#!hs
 {-# LANGUAGE TypeFamilyDependencies #-}

 type family F a = b | b -> a

 fid :: (F a ~ F b) => a -> b
 fid x = x
 }}}

 {{{
 Could not deduce: a ~ b
 from the context: F a ~ F b
 }}}

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


More information about the ghc-tickets mailing list