summaryrefslogtreecommitdiff
path: root/testsuite/tests/deriving/should_compile/T2856.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/deriving/should_compile/T2856.hs')
-rw-r--r--testsuite/tests/deriving/should_compile/T2856.hs28
1 files changed, 28 insertions, 0 deletions
diff --git a/testsuite/tests/deriving/should_compile/T2856.hs b/testsuite/tests/deriving/should_compile/T2856.hs
new file mode 100644
index 0000000000..c8f81a00bc
--- /dev/null
+++ b/testsuite/tests/deriving/should_compile/T2856.hs
@@ -0,0 +1,28 @@
+{-# LANGUAGE TypeFamilies, GeneralizedNewtypeDeriving, StandaloneDeriving, FlexibleInstances #-}
+
+-- Test Trac #2856
+
+module T2856 where
+
+import Data.Ratio
+
+----------------------
+class C a where
+ data D a
+
+instance C Bool where
+ newtype D Bool = DInt Int deriving (Eq, Show, Num)
+
+instance C a => C [a] where
+ newtype D [a] = DList (Ratio a) deriving (Eq, Show, Num)
+
+----------------------
+data family W a
+newtype instance W Bool = WInt Int deriving( Eq, Show )
+newtype instance W [a] = WList (Ratio a) deriving( Eq, Show )
+
+deriving instance Num (W Bool)
+deriving instance (Integral a, Num a) => Num (W [a])
+ -- Integral needed because superclass Eq needs it,
+ -- because of the stupid context on Ratio
+