[GHC] #15347: QuantifiedConstraints: Implication constraints with type families don't work

GHC ghc-devs at haskell.org
Thu Jul 26 23:11:56 UTC 2018


#15347: QuantifiedConstraints: Implication constraints with type families don't
work
-------------------------------------+-------------------------------------
        Reporter:  aaronvargo        |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.5
  checker)                           |             Keywords:
      Resolution:                    |  QuantifiedConstraints
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by aaronvargo):

 I don't see why that is though. Why can't `ft` be made an implicit
 parameter to the class?

 If it were possible to explicitly bind the implicit parameters of a class,
 perhaps we could write something like:

 {{{#!hs
 class forall ft. (ft ~ F t, forall a. Eq a => Eq (ft a)) => C t
 }}}

 Hmm, it is possible to make `ft` implicit using a proxy though:

 {{{#!hs
 class (ft ~ F t, forall a. Eq a => Eq (ft a)) => C (p :: Proxy ft) t where
   type F t :: * -> *

 -- this works
 foo :: forall t a. (C 'Proxy t, Eq a) => Dict (Eq (F t a))
 foo = Dict
 }}}

 This still requires adding a parameter, but would only require adding one
 to each class rather than potentially several, as we can use a single
 proxy for all of the extra parameters.

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


More information about the ghc-tickets mailing list