summaryrefslogtreecommitdiff
path: root/testsuite/tests/deSugar/should_run/dsrun009.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/deSugar/should_run/dsrun009.hs')
-rw-r--r--testsuite/tests/deSugar/should_run/dsrun009.hs16
1 files changed, 16 insertions, 0 deletions
diff --git a/testsuite/tests/deSugar/should_run/dsrun009.hs b/testsuite/tests/deSugar/should_run/dsrun009.hs
new file mode 100644
index 0000000000..104f1af2e3
--- /dev/null
+++ b/testsuite/tests/deSugar/should_run/dsrun009.hs
@@ -0,0 +1,16 @@
+-- !!! Test that 'negate' is used properly to construct negative literals
+
+main = print (minusTwo,trueOrFalse)
+
+minusTwo = -2::N
+
+trueOrFalse =
+ case minusTwo of
+ -2 -> True
+ _ -> False
+
+data N = Negate N | FromInteger Integer deriving (Eq,Show)
+
+instance Num N where
+ negate = Negate
+ fromInteger = FromInteger