summaryrefslogtreecommitdiff
path: root/testsuite/tests/deriving/should_run/drvrun021.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/deriving/should_run/drvrun021.hs')
-rw-r--r--testsuite/tests/deriving/should_run/drvrun021.hs20
1 files changed, 20 insertions, 0 deletions
diff --git a/testsuite/tests/deriving/should_run/drvrun021.hs b/testsuite/tests/deriving/should_run/drvrun021.hs
new file mode 100644
index 0000000000..05c7c8dbf0
--- /dev/null
+++ b/testsuite/tests/deriving/should_run/drvrun021.hs
@@ -0,0 +1,20 @@
+module Main where
+
+class Show a => Foo a where
+ op :: a -> a
+
+newtype Moose = MkMoose () deriving (Show, Eq, Ord)
+
+newtype Noose = MkNoose () deriving (Ord)
+
+instance Eq Noose where
+ a == b = False -- Non-standard!
+
+f :: Ord a => a -> Bool
+f x = x==x
+
+main = do print (MkNoose () == MkNoose ()) -- Eq Noose
+ print (f (MkNoose ())) -- via Ord Noose
+ print (MkMoose () == MkMoose ()) -- Eq Moose
+ print (f (MkMoose ())) -- via Ord Moose
+ putStrLn (show (MkMoose ())) -- Should not use the show () method