#3714: Improve error message if an associated family declaration has excess
parameters
---------------------------+------------------------------------------------
  Reporter:  simonpj       |          Owner:  chak            
      Type:  bug           |         Status:  new             
  Priority:  normal        |      Milestone:                  
 Component:  Compiler      |        Version:  6.10.4          
Resolution:                |       Keywords:                  
Difficulty:                |             Os:  Unknown/Multiple
  Testcase:                |   Architecture:  Unknown/Multiple
   Failure:  None/Unknown  |  
---------------------------+------------------------------------------------
Changes (by chak):

  * summary:  Associated types missing useful functionality => Improve
              error message if an associated family
              declaration has excess parameters

Comment:

 No, it's not a bug.  The second example ought to be written:
 {{{
 class C2 f where
   type T2 f :: * -> *
   op2 :: T2 f e -> Either e a
 }}}
 The parameters of an associated family declaration must be a subset of the
 class parameters as documented at
 
[http://haskell.org/haskellwiki/GHC/Type_families#Associated_family_declarations_2].

 However, remember that
 {{{
 type family S1 a :: * -> *
 }}}
 and
 {{{
 type family S2 a b :: *
 }}}
 are '''not''' the same thing.  `S1` has one type index (and in each
 occurrence must be applied to at least one argument), whereas `S2` has two
 type indices (and in each occurrence must be applied to at least two type
 arguments).  (BTW, I'm not saying that this is the only design that's
 possible, but it is what we decided to be most useful at the time.)

 However, the error message can certainly be improved!

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3714#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to