From 805982e8647bf771be926addce6587e903f1750b Mon Sep 17 00:00:00 2001 From: simonpj <unknown> Date: Mon, 23 Aug 1999 15:13:07 +0000 Subject: [PATCH] [project @ 1999-08-23 15:13:07 by simonpj] Add simpl005, tests CPR --- .../simplCore/should_compile/simpl005.hs | 25 +++++++++++++++++++ .../simplCore/should_compile/simpl005.stderr | 0 2 files changed, 25 insertions(+) create mode 100644 ghc/tests/simplCore/should_compile/simpl005.hs create mode 100644 ghc/tests/simplCore/should_compile/simpl005.stderr diff --git a/ghc/tests/simplCore/should_compile/simpl005.hs b/ghc/tests/simplCore/should_compile/simpl005.hs new file mode 100644 index 000000000000..f342bd524f91 --- /dev/null +++ b/ghc/tests/simplCore/should_compile/simpl005.hs @@ -0,0 +1,25 @@ +--!!! CPR on newtype with polymorphic argument + +{-# OPTIONS -O #-} + +module ShouldCompile where + +data StateM m s a = STM (s -> m (a,s)) + +instance Functor m => Functor (StateM m s) where + fmap f (STM xs) = STM (\s -> fmap (\ (x,s') -> (f x, s')) + (xs s) + ) +{- With GHC 4.04 (first release) this program gave: + + panic! (the `impossible' happened): + mk_cpr_let: not a product + forall a{-ruq-} b{-rur-}. + (a{-ruq-} -> b{-rur-}) + -> MonadLibrary.StateM{-r2o,x-} m{-a30Y-} s{-a30Z-} a{-ruq-} + -> MonadLibrary.StateM{-r2o,x-} m{-a30Y-} s{-a30Z-} b{-rur-} + + The reason: 'Functor' is a newtype, whose element is a for-all type. + + newtype Functor f = Functor (forall a,b. (a->b) -> f a -> f b) +-} diff --git a/ghc/tests/simplCore/should_compile/simpl005.stderr b/ghc/tests/simplCore/should_compile/simpl005.stderr new file mode 100644 index 000000000000..e69de29bb2d1 -- GitLab