[GHC] #8565: New GeneralisedNewtypeDeriving needs help with higher rank types

GHC ghc-devs at haskell.org
Tue Nov 26 15:11:57 UTC 2013


#8565: New GeneralisedNewtypeDeriving needs help with higher rank types
-------------------------------------------------+-------------------------
        Reporter:  simonpj                       |            Owner:
            Type:  bug                           |           Status:  new
        Priority:  normal                        |        Milestone:
       Component:  Compiler                      |          Version:  7.6.3
      Resolution:                                |         Keywords:
Operating System:  Unknown/Multiple              |     Architecture:
 Type of failure:  None/Unknown                  |  Unknown/Multiple
       Test Case:                                |       Difficulty:
  typecheck/should_compile/T8565                 |  Unknown
        Blocking:                                |       Blocked By:
                                                 |  Related Tickets:
-------------------------------------------------+-------------------------

Comment (by nomeata):

 Unfortunately, it seems that no such instances, with `forall` on the left,
 existed so far, so writing it by hand yields `Malformed instance head`.

 I tried to trick GHC to accept a forall on the left hand side of the
 instance heads (using `ConstraintTypes` and `KindSignatures`)
 {{{
 class C a where op :: a
 type Foo (a:: * -> Constraint) = forall b. a b
 instance Foo C => C Int
 }}}
 but that only yielded
 {{{
     Malformed predicate ‛Foo C’
     In the context: (Foo C)
     While checking an instance declaration
     In the instance declaration for ‛C Int’
 }}}


 Do we really want instances for `Coercible` where the instance head is not
 valid GHC code? (I don’t even dare to call it Haskell code ;-)) Or can the
 instance be somehow phrased differently?

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


More information about the ghc-tickets mailing list