summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_run/tcrun019.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/typecheck/should_run/tcrun019.hs')
-rw-r--r--testsuite/tests/typecheck/should_run/tcrun019.hs21
1 files changed, 21 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_run/tcrun019.hs b/testsuite/tests/typecheck/should_run/tcrun019.hs
new file mode 100644
index 0000000000..266e01d9c0
--- /dev/null
+++ b/testsuite/tests/typecheck/should_run/tcrun019.hs
@@ -0,0 +1,21 @@
+{-# LANGUAGE ImplicitParams, RankNTypes #-}
+
+-- GHC 5.02 got this one wrong.
+
+module Main where
+
+-- Implicit parameters bug
+-- mbs@cse.ogi.edu 24-Oct-2001 22:21:27
+
+f :: (?x :: Int) => ((?x :: Int) => Int) -> Int -> Int
+f g y = if y == 0
+ then g
+ else let ?x = ?x + 1
+ in f g (y - 1)
+
+h :: (?x :: Int) => Int
+h = ?x
+
+main = print (let ?x = 0 in f h 10)
+-- The result should be 10!
+