#6083: GeneralizedNewtypeDeriving: "deriving ALL"
------------------------------+---------------------------------------------
Reporter: clinton | Owner:
Type: feature request | Status: new
Priority: normal | Component: Compiler
Version: 7.4.1 | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: None/Unknown | Testcase:
Blockedby: | Blocking:
Related: |
------------------------------+---------------------------------------------
Comment(by clinton):
'''(Repost with better formatting)'''
I've found I've wanted to do:
{{{
newtype X1 = X1 ( X ) deriving ( ALL )
newtype X2 = X2 ( X ) deriving ( ALL )
}}}
When I want X1, X2 to behave like X, but I might later want to add them to
different instances, i.e.
{{{
class Silly a where
double :: a -> a
instance Silly X1 where
double x = 2 * x
instance Silly X2 where
double x = 3 * x -- Silly double
}}}
Currently, it seems to be the only way to do this is to dig into the
source of X and find every instance it has. It would be nice to be able to
simply to "deriving ALL" to make XN in "newtype XN = XN X" behave exactly
the same as X.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6083#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs