|
#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: | ------------------------------+--------------------------------------------- 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 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> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
#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 [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#6083: GeneralizedNewtypeDeriving: "deriving ALL"
-------------------------------+-------------------------------------------- Reporter: clinton | Owner: Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.4.1 Resolution: wontfix | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: -------------------------------+-------------------------------------------- Changes (by igloo): * status: new => closed * difficulty: => Unknown * resolution: => wontfix Comment: Thanks for the suggestion. However, the interaction of this with orphan instances sounds tricky. Unless there's a lot more demand for it I don't think that it's worthwhile. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6083#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
| Powered by Nabble | Edit this page |
