summaryrefslogtreecommitdiff
path: root/testsuite/tests/codeGen/should_compile/T3286b.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/codeGen/should_compile/T3286b.hs')
-rw-r--r--testsuite/tests/codeGen/should_compile/T3286b.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/testsuite/tests/codeGen/should_compile/T3286b.hs b/testsuite/tests/codeGen/should_compile/T3286b.hs
new file mode 100644
index 0000000000..f6c1fdbeac
--- /dev/null
+++ b/testsuite/tests/codeGen/should_compile/T3286b.hs
@@ -0,0 +1,15 @@
+
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+
+module T3286b (LogFloat) where
+
+newtype LogFloat = LogFloat Double
+ deriving (Eq, Ord, Num, Show)
+
+instance Fractional LogFloat where
+ (/) (LogFloat x) (LogFloat y)
+ | x == 1
+ && y == 1 = error "(/)"
+ | otherwise = LogFloat (x-y)
+ fromRational = LogFloat . fromRational
+