Commit 9d22874f authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Merge branch 'master' of http://darcs.haskell.org/testsuite

parents 8cddd701 9de0eb95
{-# LANGUAGE Rank2Types #-}
module T6069 where
import Control.Monad.ST
import Data.STRef
fourty_two :: forall s. ST s Int
fourty_two = do
x <- newSTRef (42::Int)
readSTRef x
f1 = (print . runST) fourty_two -- (1)
f2 = (print . runST) $ fourty_two -- (2)
f3 = ((print . runST) $) fourty_two -- (3)
T6069.hs:13:15:
Couldn't match type `ST s0 Int' with `forall s. ST s b0'
Expected type: ST s0 Int -> b0
Actual type: (forall s. ST s b0) -> b0
In the second argument of `(.)', namely `runST'
In the expression: print . runST
In the expression: (print . runST) fourty_two
T6069.hs:14:15:
Couldn't match type `ST s1 Int' with `forall s. ST s b1'
Expected type: ST s1 Int -> b1
Actual type: (forall s. ST s b1) -> b1
In the second argument of `(.)', namely `runST'
In the expression: (print . runST)
In the expression: (print . runST) $ fourty_two
T6069.hs:15:16:
Couldn't match type `ST s2 Int' with `forall s. ST s b2'
Expected type: ST s2 Int -> b2
Actual type: (forall s. ST s b2) -> b2
In the second argument of `(.)', namely `runST'
In the first argument of `($)', namely `(print . runST)'
In the expression: (print . runST) $
{-# LANGUAGE RankNTypes #-}
module T7264 where
data Foo = Foo (forall r . r -> String)
mmap :: (a->b) -> Maybe a -> Maybe b
mmap f (Just x) = Just (f x)
mmap f Nothing = Nothing
-- mkFoo2 :: (forall r. r -> String) -> Maybe Foo
-- Should be rejected because it requires instantiating
-- mmap at a polymorphic type
mkFoo2 val = mmap Foo (Just val)
T7264.hs:13:19:
Couldn't match type `a' with `forall r. r -> String'
`a' is untouchable
inside the constraints ()
bound by the inferred type of mkFoo2 :: a -> Maybe Foo
at T7264.hs:13:1-32
`a' is a rigid type variable bound by
the inferred type of mkFoo2 :: a -> Maybe Foo at T7264.hs:13:1
Expected type: a -> Foo
Actual type: (forall r. r -> String) -> Foo
Relevant bindings include
mkFoo2 :: a -> Maybe Foo (bound at T7264.hs:13:1)
val :: a (bound at T7264.hs:13:8)
In the first argument of `mmap', namely `Foo'
In the expression: mmap Foo (Just val)
In an equation for `mkFoo2': mkFoo2 val = mmap Foo (Just val)
......@@ -284,3 +284,5 @@ test('T7175', normal, compile_fail, [''])
test('T7210', normal, compile_fail, [''])
test('T6161', normal, compile_fail, [''])
test('T7368', normal, compile_fail, [''])
test('T7264', normal, compile_fail, [''])
test('T6069', normal, compile_fail, [''])
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