Testsuite: tabs -> spaces [skip ci]
[ghc.git] / testsuite / tests / typecheck / should_fail / tcfail126.hs
1 {-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
2 {-# LANGUAGE RankNTypes, ExistentialQuantification #-}
3
4 -- An interesting interaction of universals and existentials, prompted by
5 -- http://www.haskell.org/pipermail/haskell-cafe/2004-October/007160.html
6 --
7 -- Note the nested pattern-match in runProg; tc183 checks the
8 -- non-nested version
9
10 -- 3 Sept 2010: with the new typechecker, this one succeeds
11
12 module Foo where
13
14 import Control.Monad.Trans
15
16 data Bar m
17 = forall t. (MonadTrans t, Monad (t m))
18 => Bar (t m () -> m ()) (t m Int)
19
20 data Foo = Foo (forall m. Monad m => Bar m)
21
22 runProg :: Foo -> IO ()
23 runProg (Foo (Bar run op)) = run (prog op)
24 -- This nested match "ought" to work; because
25 -- runProg (Foo b) = case b of
26 -- Bar run op -> run (prog op)
27 -- does work. But the interactions with GADTs and
28 -- desugaring defeated me, and I removed (in GHC 6.4) the ability
29 -- to instantiate functions on the left
30
31 prog :: (MonadTrans t, Monad (t IO)) => a -> t IO ()
32 prog x = error "urk"