"less polymophic" problem
Seth Kurtzberg
seth@cql.com
Tue, 29 Apr 2003 19:17:41 -0700
Hello list,
I don't know how to solve this problem. Using GHC 5.04.3.
The following snippet shows the problem, as minimally as I could.
tl2 = ["123","abc","def"]
tl3 = newSTRef tl2
-- this works:
tl3unref = runST(tl3 >>= \ref -> readSTRef ref)
-- this code, the same but with a formal parameter, doesn't compile:
-- this is line 61 in the error message below
getaline rlines = runST(rlines >>= \ref -> readSTRef ref)
--ghci complains as follows:
Inferred type is less polymorphic than expected
Quantified type variable `s' escapes
It is mentioned in the environment:
rlines :: ST s (STRef s a) (bound at misstring.hs:61)
In the first argument of `runST', namely
`(rlines >>= (\ ref -> readSTRef ref))'
In the definition of `getaline':
runST (rlines >>= (\ ref -> readSTRef ref))
-- I tried the following signature for getaline:
getaline :: forall s. ST s (STRef s [[Char]]) -> [[Char]]
-- which does not change the error. The type in the signature for
-- rlines is that displayed by ghci for tl3
Any help will be greatly appreciated.
TIA
--
Seth Kurtzberg
MIS Corp
480-661-1849
seth@cql.com