Commit 42a7e04d authored by simonpj's avatar simonpj
Browse files

[project @ 2001-11-02 10:20:51 by simonpj]

Add another test
parent 424cd45b
......@@ -101,3 +101,4 @@ test "tcfail099" { vtcf("") }
test "tcfail100" { vtcf("") }
test "tcfail101" { vtcf("") }
test "tcfail102" { vtcf("") }
test "tcfail103" { vtcf("") }
{-# OPTIONS -fglasgow-exts #-}
-- !!! Scoped type variables in result signatures
-- This one is a bit crafty
module ShouldCompile where
import PrelST
import PrelArr
-- Note the *pattern* type sig on f, which forces it
-- to be monomorphic; but the separate type sig makes
-- it polymorphic; hence the error.
f:: ST t Int
f:: ST s Int = do
v <- newSTRef 5
let g :: ST s Int
-- ^ should be in scope
g = readSTRef v
g
tcfail103.hs:14:
Inferred type is less polymorphic than expected
Quantified type variable `t' escapes
It unifies with `s', which is mentioned in the environment:
Type variable `s'
is bound by pattern type signature at tcfail103.hs:15
Signature type: forall t. ST t Int
Type to generalise: ST s Int
When checking the type signature for `f'
When generalising the type(s) for f
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