[GHC] #10009: type inference regression when faking injective type families

GHC ghc-devs at haskell.org
Fri Jan 23 18:27:02 UTC 2015


#10009: type inference regression when faking injective type families
-------------------------------------+-------------------------------------
        Reporter:  aavogt            |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  high              |               Milestone:  7.10.1
       Component:  Compiler (Type    |                 Version:  7.10.1-rc1
  checker)                           |                Keywords:
      Resolution:                    |            Architecture:
Operating System:  Unknown/Multiple  |  Unknown/Multiple
 Type of failure:  GHC rejects       |               Test Case:
  valid program                      |                Blocking:
      Blocked By:                    |  Differential Revisions:
 Related Tickets:                    |
-------------------------------------+-------------------------------------

Comment (by aavogt):

 for what it's worth, ghc-7.10RC1 handles FDs correctly (see
 http://stackoverflow.com/questions/24110410/type-families-get-stuck-where-
 the-equivalent-type-using-functional-dependencies), as well as MPTCs+TFs
 so long as f doesn't use the TFs directly:

 {{{
 class (b ~ GetB a, a ~ GetA b, Show a) => C b a where
     type GetB a
     type GetA b
     f :: b -> a
     -- f :: GetB a -> a -- but not this one!

 g :: forall a b. C b a => a -> String
 g _ = show a
   where a = f (undefined :: GetB a) -- :: a
 }}}

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


More information about the ghc-tickets mailing list