Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#8963 closed bug (fixed)

GeneralizedNewtypeDeriving unusable on associated types

Reported by: mojojojo Owned by:
Priority: normal Milestone: 7.8.3
Component: Compiler Version: 7.6.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

This code:

{-# LANGUAGE GeneralizedNewtypeDeriving #-}

class C c where
  data F c r

instance C Int where
  newtype F Int r = F (IO r) deriving (Functor)

fails to compile with the following message:

    Derived instance `Functor (F Int)'
      requires illegal partial application of data type family F
    In the newtype instance declaration for `F'

This might be related to https://ghc.haskell.org/trac/ghc/ticket/4185, but then it is marked as fixed in GHC 7.6.2, and I experience my error on 7.6.3.

Change History (7)

comment:1 Changed 5 years ago by simonpj

Resolution: fixed
Status: newclosed

Yes, it was indeed fixed some time ago. We don't back-port language changes to patch releases (in this case 7.6.3). But the fix is in 7.8 which will be out any day.

Simon

comment:2 in reply to:  1 Changed 5 years ago by mojojojo

Oh great! Thanks!

comment:3 Changed 5 years ago by Simon Peyton Jones <simonpj@…>

In 848f595266268f578480ceb4ab1ce4938611c97e/ghc:

Allow a longer demand signature than arity

See Note [Demand analysis for trivial right-hand sides] in DmdAnal.
This allows a function with arity 2 to have a DmdSig with 3 args;
which in turn had a knock-on effect, which showed up in the test for
Trac #8963.

In fact it seems entirely reasonable, so this patch removes the
WARN and CoreLint checks that were complaining.

comment:4 Changed 5 years ago by Simon Peyton Jones <simonpj@…>

comment:5 Changed 5 years ago by thoughtpolice

Status: closedmerge

comment:6 Changed 5 years ago by thoughtpolice

Status: mergeclosed

comment:7 Changed 5 years ago by thoughtpolice

Milestone: 7.8.3
Note: See TracTickets for help on using tickets.