[commit: testsuite] master: Test Trac #5691 (14ff0b8)

Simon Peyton Jones simonpj at microsoft.com
Mon Apr 23 15:36:24 CEST 2012


Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/14ff0b8c164bb92f0ef2df875bdb884431847515

>---------------------------------------------------------------

commit 14ff0b8c164bb92f0ef2df875bdb884431847515
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Thu Dec 15 17:37:02 2011 +0000

    Test Trac #5691

>---------------------------------------------------------------

 tests/typecheck/should_fail/T5691.hs     |   29 +++++++++++++++++++++++++++++
 tests/typecheck/should_fail/T5691.stderr |   14 ++++++++++++++
 tests/typecheck/should_fail/all.T        |    1 +
 3 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/tests/typecheck/should_fail/T5691.hs b/tests/typecheck/should_fail/T5691.hs
new file mode 100644
index 0000000..c63ba7b
--- /dev/null
+++ b/tests/typecheck/should_fail/T5691.hs
@@ -0,0 +1,29 @@
+{-# LANGUAGE ScopedTypeVariables #-}
+
+module GHCBug where
+
+import Control.Applicative as Ap
+import Control.Monad (MonadPlus, mplus, mzero)
+import Control.Monad.Identity (Identity, runIdentity)
+
+newtype PrintRuleInterp v = MkPRI { printRule_ :: Int -> String }
+class Test p where
+  test :: p a -> p a
+
+instance Test PrintRuleInterp where
+  test (f :: p a) =
+    MkPRI $ printRule_ f 
+
+
+newtype RecDecParser a = MkRD {
+  parseRD :: String -> [(String, a)]
+  }
+
+pure_ v = MkRD $ \s -> pure (s , v)
+
+instance MonadPlus RecDecParser where
+  mzero = MkRD $ const Ap.empty
+  mplus a b = MkRD $ const Ap.empty
+
+
+
diff --git a/tests/typecheck/should_fail/T5691.stderr b/tests/typecheck/should_fail/T5691.stderr
new file mode 100644
index 0000000..bfc572c
--- /dev/null
+++ b/tests/typecheck/should_fail/T5691.stderr
@@ -0,0 +1,14 @@
+
+T5691.hs:15:24:
+    Couldn't match type `p' with `PrintRuleInterp'
+    Expected type: PrintRuleInterp a
+      Actual type: p a
+    In the first argument of `printRule_', namely `f'
+    In the second argument of `($)', namely `printRule_ f'
+    In the expression: MkPRI $ printRule_ f
+
+T5691.hs:24:10:
+    No instance for (Monad RecDecParser)
+      arising from the superclasses of an instance declaration
+    Possible fix: add an instance declaration for (Monad RecDecParser)
+    In the instance declaration for `MonadPlus RecDecParser'
diff --git a/tests/typecheck/should_fail/all.T b/tests/typecheck/should_fail/all.T
index 03f0f7b..91f759d 100644
--- a/tests/typecheck/should_fail/all.T
+++ b/tests/typecheck/should_fail/all.T
@@ -268,3 +268,4 @@ test('T3592', normal, compile_fail, [''])
 test('T5570', normal, compile_fail, [''])
 test('T5573a', normal, compile_fail, [''])
 test('T5573b', normal, compile_fail, [''])
+test('T5691', normal, compile_fail, [''])





More information about the Cvs-ghc mailing list