Opened 6 years ago

Closed 6 years ago

#2907 closed feature request (wontfix)

generalized newtype deriving not working with polymorphic component

Reported by: jeltsch Owned by:
Priority: normal Milestone:
Component: Compiler Version: 6.10.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:


I’d like generalized newtype deriving to work also with polymorphic components like in this example:

{-# LANGUAGE GeneralizedNewtypeDeriving, RankNTypes #-}

import Control.Monad.Cont

newtype PolyContT monad o = PolyContT (forall result. ContT result monad o)
                            deriving (Monad)

Would this be possible?

Change History (1)

comment:1 Changed 6 years ago by simonpj

  • difficulty set to Unknown
  • Resolution set to wontfix
  • Status changed from new to closed

No, sorry, you'll have to write this one by hand! The newtype deriving stuff works when there is an existing instance that is related only by a newtype to the new instance you want. Thus

newtype N = MkN <old-type>

But there is no instance Monad (forall result. ContT result monad o). One could imagine a further extension to handle this, somehow, but I don't think it'd be easy.


Note: See TracTickets for help on using tickets.