Commit c097002a authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Add a test for impredicative polymorphism

parent b8e14b39
......@@ -150,3 +150,4 @@ test('tcfail161', normal, compile_fail, [''])
test('tcfail162', normal, compile_fail, [''])
test('tcfail163', normal, compile_fail, [''])
test('tcfail164', normal, compile_fail, [''])
test('tcfail165', normal, compile_fail, [''])
{-# OPTIONS -fglasgow-exts #-}
module ShouldFail where
import Control.Concurrent
-- Attempt to put a polymorphic value in an MVar
-- Fails, but the error message is worth keeping an eye on
foo = do var <- newEmptyMVar :: IO (MVar (forall a. Show a => a -> String))
putMVar var (show :: forall a. Show a => a -> String)
tcfail165.hs:11:22:
Couldn't match expected type `forall a. (Show a) => a -> String'
against inferred type `a -> String'
In the second argument of `putMVar', namely
`(show :: forall a. (Show a) => a -> String)'
In the expression:
putMVar var (show :: forall a. (Show a) => a -> String)
In the expression:
do var <- newEmptyMVar ::
IO (MVar (forall a. (Show a) => a -> String))
putMVar var (show :: forall a. (Show a) => a -> String)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment