[GHC] #7543: Constraint synonym instances

GHC cvs-ghc at haskell.org
Sat Jan 12 13:14:29 CET 2013


#7543: Constraint synonym instances
---------------------------------+------------------------------------------
    Reporter:  monoidal          |       Owner:                  
        Type:  bug               |      Status:  new             
    Priority:  normal            |   Milestone:                  
   Component:  Compiler          |     Version:  7.6.1           
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------
Changes (by ekmett):

 * cc: ekmett@… (added)


Comment:

 FWIW some form of fix for this would be quite useful to me as well.

 In the {{{lens}}} package we have a lot of classes that look like

 {{{
 class Foo s t a b | s -> a, t -> b, s a -> t, t a -> s
 }}}

 where s = t, a = b are always legal to instantiate, so many instances look
 like

 {{{
 class IsText Text Text Char Char
 }}}

 when we're dealing with these 4 parameter families for data types we adopt
 the convention that

 {{{
 type Foo' a b = Foo a a b b
 }}}

 But we cannot do this for the declaration site for the instances.

 If we could this would (eventually, when we can remove support for pre-
 constraint kinds compilers) enable us to more easily expand our
 definitions later on.

 More pie-in-the-sky would be being able to use

 {{{
 type Foo a b = Bar a => Baz a b
 }}}

 {{{
 instance Foo a b
 }}}

 as

 {{{
 instance Bar a => Baz a b
 }}}

 it would be consistent with the other uses of type, but {{{Bar a => Baz a
 b}}} doesn't (currently) have a sensible kind.

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



More information about the ghc-tickets mailing list