[GHC] #2165: Type checker for Type families

GHC trac at galois.com
Tue Mar 18 15:42:32 EDT 2008


#2165: Type checker for Type families
-------------------------+--------------------------------------------------
    Reporter:  hpacheco  |       Owner:                         
        Type:  bug       |      Status:  new                    
    Priority:  normal    |   Component:  Compiler (Type checker)
     Version:  6.9       |    Severity:  normal                 
    Keywords:            |    Testcase:                         
Architecture:  Unknown   |          Os:  Unknown                
-------------------------+--------------------------------------------------
 For a type family and a class definition:

 type family F a x :: *

 class FunctorF x where
         fmapF :: d -> (a -> b) -> F x a -> F x b

 Curiously if I have


 {{{
 fff a = fmapF a id
 }}}


 it compiles correctly. But if I infer the type signature of fff I get

 {{{

 fff :: forall d x. (FunctorF d) => d -> F d x -> F d x
 }}}


 On the other side, a similar problem as before arises when


 {{{
 fff :: forall d x. (FunctorF d) => d -> F d x -> F d x
 fff a = fmapF a id
 }}}

 This follows up from http://hackage.haskell.org/trac/ghc/ticket/2157

 On Tue, Mar 18, 2008 at 7:03 PM, Ryan Ingram <ryani.spam at gmail.com> wrote:
 Interestingly, this works when you also give a type signature to "id":

 {{{

 fff :: forall d x. (FunctorF d) => d -> F d x -> F d x
 fff a = fmapF a (id :: x -> x)
 }}}


 compiles for me (ghc6.8.2).  There's probably a bug in the type
 checker; inference is working with no type signatures, but checking
 fails.

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


More information about the Glasgow-haskell-bugs mailing list