diff options
Diffstat (limited to 'testsuite/tests/typecheck/should_compile/T4917.hs')
-rw-r--r-- | testsuite/tests/typecheck/should_compile/T4917.hs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/T4917.hs b/testsuite/tests/typecheck/should_compile/T4917.hs new file mode 100644 index 0000000000..f6d51d4c27 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T4917.hs @@ -0,0 +1,21 @@ +{-# LANGUAGE GADTs, ScopedTypeVariables, EmptyDataDecls, RankNTypes #-} + +module T4917 where + +-- only works on ghc6 but not on ghc7 +type Const a b = a + +newtype Fix f n = In { out :: f (Fix f) n } + +mcata :: forall f a b . + (forall x c . (forall d . x d -> Const b d) -> f x c -> Const b c) + -> Fix f a -> Const b a +mcata f x = f {- x=(Fix f), c=a -} mcataf outx + where + outx :: f (Fix f) a + outx = out x + + mcataf :: forall d. Fix f d -> Const b d + mcataf y = mcata {- f=f, a=d, b=b0 -} f (y :: Fix f d) + -- Const b d ~ Const b0 d + -- Expected type of f :: forall x c. (forall d. x d -> Const b0 d) -> f x c -> Const b0 c |