Opened 8 years ago

Closed 8 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: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

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 8 years ago by simonpj

difficulty: Unknown
Resolution: wontfix
Status: newclosed

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.

Simon

Note: See TracTickets for help on using tickets.