[GHC] #9747: Odd failure to deduce a constraint

GHC ghc-devs at haskell.org
Fri Oct 31 08:52:39 UTC 2014


#9747: Odd failure to deduce a constraint
-------------------------------------+-------------------------------------
              Reporter:  acowley     |            Owner:
                  Type:  bug         |           Status:  closed
              Priority:  normal      |        Milestone:
             Component:  Compiler    |          Version:  7.8.3
            Resolution:  fixed       |         Keywords:  TypeFamilies
      Operating System:              |  ConstraintKinds
  Unknown/Multiple                   |     Architecture:  Unknown/Multiple
       Type of failure:              |       Difficulty:  Unknown
  None/Unknown                       |       Blocked By:
             Test Case:              |  Related Tickets:
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
Changes (by simonpj):

 * status:  infoneeded => closed
 * resolution:   => fixed


Comment:

 It's a bug in GHC 7.8.3, fixed in upcoming 7.8.4 and HEAD, and not present
 in 7.8.2.  Both say
 {{{
 T9747.hs:35:8:
     Type family ‘ConFun’ should have 2 arguments, but has been given 1
     In the type signature for ‘bar’:
       bar :: HListAll (ConFun l) ts => Proxy l -> HList ts -> ()
 }}}
 And that's right!

 This works though
 {{{
 type family ConFun (t :: *) :: * -> Constraint
 data Tag
 type instance ConFun Tag = Group

 class (Show a, Eq a, Ord a) => Group a

 bar :: HListAll (ConFun l) ts => Proxy l -> HList ts -> ()
 bar _ _ = ()

 baz :: (ConFun l a, ConFun l b) => Proxy l -> HList [a,b] -> ()
 baz = bar
 }}}
 I've eta-reduced `ConFun`, but then I had to give a fresh name to the RHS
 via the class decl for `Group`.

 I'll add the working version as a regression test.

 Simon

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


More information about the ghc-tickets mailing list