#2157: Equality Constraints with Type Families
----------------------------------------+-----------------------------------
    Reporter:  hpacheco                 |        Owner:  chak    
        Type:  feature request          |       Status:  new     
    Priority:  normal                   |    Milestone:          
   Component:  Compiler (Type checker)  |      Version:  6.9     
    Severity:  normal                   |   Resolution:          
    Keywords:                           |     Testcase:          
Architecture:  Multiple                 |           Os:  Multiple
----------------------------------------+-----------------------------------
Comment (by chak):

 Replying to [comment:9 claus]:
 > Replying to [comment:7 chak]:
 > > {{{
 > > {-# LANGUAGE TypeFamilies #-}
 > >
 > > type family Const a :: * -> *
 > > type instance Const a = C a
 > > type C a t = a
 > > }}}
 > >
 > > Why do you think `Const` is fishy?
 >
 > because:
 >
 > - type synonym `C` appears partially applied in what amounts to a type
 class instance parameter position (the rhs of the Const instance)

 I don't agree that the lhs of a type instance amounts to a type class
 instance parameter position;  type instance have nothing to do with type
 classes.

 However, I think I now understand what you are worried about.  It is the
 interaction of type families and GHC's generalised type synonyms (i.e.,
 type synonyms that may be partially applied).  I agree that it does lead
 to an odd interaction, because the outcome may depend on the order in
 which the type checker performs various operations.  In particular,
 whether it first applies a type instance declaration to reduce a type
 family application or whether it first performs decomposition.

 The most clean solution may indeed be to outlaw partial applications of
 vanilla type synonyms in the rhes of type instances.  (Which is what I
 will implement unless anybody has a better idea.)

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2157#comment:10>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to